| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../http/tests/inspector/resources/inspector-test.js"></script> |
| <script src="../resources/log-pause-location.js"></script> |
| <script> |
| function a() { |
| return 1; |
| } |
| |
| function b() { |
| return 2; |
| } |
| |
| function entryDefaultParameterExpression() { |
| function add(a=1, b=2) { |
| return a + b; |
| } |
| debugger; |
| add(); |
| add(1); |
| add(1, 2); |
| } |
| |
| function entryDefaultParameterCallExpression() { |
| function add(x=a(), y=b()) { |
| return x + y; |
| } |
| debugger; |
| add(); |
| add(1); |
| add(1, 2); |
| } |
| |
| // --------- |
| |
| function test() |
| { |
| let suite = InspectorTest.createAsyncSuite("Debugger.stepping.function-default-parameters"); |
| |
| window.initializeSteppingTestSuite(suite); |
| |
| addSteppingTestCase({ |
| name: "Debugger.stepping.DefaultParameterExpression", |
| description: "Should be able to step through arrow functions.", |
| expression: "setTimeout(entryDefaultParameterExpression)", |
| steps: [ |
| "over", |
| // FIXME: Opportunity to pause at assignment expressions. |
| "in", // into 1st add |
| "out", // out of 1st add |
| "in", // into 2nd add |
| "out", // out of 2nd add |
| "in", // into 3rd add |
| "out", // out of 3rd add |
| "resume", |
| ] |
| }); |
| |
| addSteppingTestCase({ |
| name: "Debugger.stepping.DefaultParameterCallExpression", |
| description: "Should be able to step through arrow functions.", |
| expression: "setTimeout(entryDefaultParameterCallExpression)", |
| steps: [ |
| "over", |
| "in", // into 1st add - before a() |
| "in", // into a |
| "out", // out of a - before b() |
| "in", // into b |
| "out", // out of b - before return |
| "out", // out of 1st add |
| |
| "in", // into 2nd add - before b() |
| "in", // into b |
| "out", // out of b - before return |
| "out", // out of 2nd add |
| |
| "in", // into 3rd add - before return |
| "out", // out of 3rd add |
| "resume", |
| ] |
| }); |
| |
| loadMainPageContent().then(() => { |
| suite.runTestCasesAndFinish(); |
| }); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Checking pause locations when stepping in, out, and over functions with default parameter expressions.</p> |
| </body> |
| </html> |