| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../http/tests/inspector/resources/inspector-test.js"></script> |
| <script src="../resources/log-pause-location.js"></script> |
| <script> |
| function entryArrowFunctionNoParenthesis() { |
| let identity = x => x; |
| let addOne = x => x + 1; |
| let square = x => { |
| return x * x; |
| }; |
| debugger; |
| identity(2); |
| addOne(1); |
| square(2); |
| } |
| |
| function entryArrowFunctionParenthesis() { |
| let nothing = () => {}; |
| let identity = (x) => x; |
| let add = (a, b) => a + b; |
| let square = x => { |
| return x * x; |
| }; |
| debugger; |
| nothing(); |
| identity(2); |
| add(1); |
| square(2); |
| } |
| |
| // --------- |
| |
| function test() |
| { |
| let suite = InspectorTest.createAsyncSuite("Debugger.stepping.arrow-functions"); |
| |
| window.initializeSteppingTestSuite(suite); |
| |
| addSteppingTestCase({ |
| name: "Debugger.stepping.ArrowFunctionNoParenthesis", |
| description: "Should be able to step through arrow functions.", |
| expression: "setTimeout(entryArrowFunctionNoParenthesis)", |
| steps: [ |
| "over", |
| "in", // into identity |
| "out", // out of identity |
| "in", // into addOne |
| "out", // out of addOne |
| "in", // into square - before return |
| "in", // complete: return - leaving square |
| "in", // out of square - leaving entry |
| "resume", |
| ] |
| }); |
| |
| addSteppingTestCase({ |
| name: "Debugger.stepping.ArrowFunctionParenthesis", |
| description: "Should be able to step through arrow functions.", |
| expression: "setTimeout(entryArrowFunctionParenthesis)", |
| steps: [ |
| "over", |
| "in", // into nothing |
| "out", // out of nothing |
| "in", // into identity |
| "out", // out of identity |
| "in", // into add |
| "out", // out of add |
| "in", // into square |
| "out", // out of square - leaving entry |
| "resume", |
| ] |
| }); |
| |
| loadMainPageContent().then(() => { |
| suite.runTestCasesAndFinish(); |
| }); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Checking pause locations when stepping in, out, and over arrow functions.</p> |
| </body> |
| </html> |