Skip to content

Commit 9fff60e

Browse files
committed
test: Check the context line seen through n steps after calling setContextLineNumber
1 parent 8b706ec commit 9fff60e

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
let x = 0;
2+
x = 1;
3+
x = 2;
4+
x = 3;
5+
x = 4;
6+
x = 5;
7+
x = 6;
8+
x = 7;
9+
x = 8;
10+
x = 9;
11+
x = 10;
12+
x = 11;
13+
x = 12;
14+
x = 13;
15+
x = 14;
16+
x = 15;
17+
x = 16;
18+
x = 17;
19+
x = 18;
20+
module.exports = x;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { skipIfInspectorDisabled } from '../common/index.mjs';
2+
skipIfInspectorDisabled();
3+
4+
import { path } from '../common/fixtures.mjs';
5+
import startCLI from '../common/debugger.js';
6+
7+
import assert from 'assert';
8+
9+
const script = path('debugger', 'twenty-lines.js');
10+
const cli = startCLI([script]);
11+
12+
function onFatal(error) {
13+
cli.quit();
14+
throw error;
15+
}
16+
17+
// Stepping through breakpoints.
18+
try {
19+
await cli.waitForInitialBreak();
20+
await cli.waitForPrompt();
21+
22+
// Make sure the initial value is 2.
23+
await cli.stepCommand('n');
24+
assert.ok(cli.output.includes("4 x = 3;"));
25+
26+
await cli.command('setContextLineNumber(5)');
27+
await cli.stepCommand('n');
28+
assert.ok(cli.output.includes("8 x = 7;"));
29+
30+
await cli.command('setContextLineNumber(3)');
31+
await cli.stepCommand('n');
32+
assert.ok(cli.output.includes("7 x = 6;"));
33+
34+
await cli.command('list(3)');
35+
await cli.stepCommand('n');
36+
assert.ok(cli.output.includes("7 x = 6;"));
37+
38+
await cli.quit();
39+
} catch (error) {
40+
onFatal(error);
41+
}

0 commit comments

Comments
 (0)