Skip to content

Commit 8ac427b

Browse files
suzmuehyangah
authored andcommitted
test: fix broken debugger tests
dlv now implements the desired behavior of continuing after a breakpoint is set. This change updates the tests to match this behavior. Updates #1838 Change-Id: I39a70d0b72c5a9f9f9b85a39829734878cf4697f Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/355950 Trust: Suzy Mueller <[email protected]> Run-TryBot: Suzy Mueller <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
1 parent bdb0b61 commit 8ac427b

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

test/integration/goDebug.test.ts

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,11 +1144,7 @@ const testAll = (ctx: Mocha.Context, isDlvDap: boolean) => {
11441144
await new Promise((resolve) => setTimeout(resolve, 2_000));
11451145
});
11461146

1147-
test('should set breakpoints during continue (legacy)', async function () {
1148-
if (isDlvDap) {
1149-
this.skip(); // not working in dlv-dap.
1150-
}
1151-
1147+
test('should set breakpoints during continue', async () => {
11521148
const PROGRAM = path.join(DATA_ROOT, 'sleep');
11531149

11541150
const FILE = path.join(DATA_ROOT, 'sleep', 'sleep.go');
@@ -1175,7 +1171,7 @@ const testAll = (ctx: Mocha.Context, isDlvDap: boolean) => {
11751171
]);
11761172
});
11771173

1178-
async function setBreakpointsWhileRunning(resumeFunc: () => void) {
1174+
async function setBreakpointsWhileRunningStep(resumeFunc: () => Promise<void>) {
11791175
const PROGRAM = path.join(DATA_ROOT, 'sleep');
11801176

11811177
const FILE = path.join(DATA_ROOT, 'sleep', 'sleep.go');
@@ -1197,18 +1193,16 @@ const testAll = (ctx: Mocha.Context, isDlvDap: boolean) => {
11971193

11981194
// The program is now stopped at the line containing time.Sleep().
11991195
// Issue a next request, followed by a setBreakpointsRequest.
1200-
resumeFunc();
1196+
await resumeFunc();
12011197

1202-
// Note: the current behavior of setting a breakpoint during a next
1203-
// request will cause the step to be interrupted, so it may not be
1204-
// stopped on the next line.
1198+
// Assert that the program completes the step request.
12051199
await Promise.all([
12061200
dc.setBreakpointsRequest({
12071201
lines: [resumeBreakpoint.line],
12081202
breakpoints: [{ line: resumeBreakpoint.line, column: 0 }],
12091203
source: { path: resumeBreakpoint.path }
12101204
}),
1211-
dc.assertStoppedLocation('pause', {})
1205+
dc.assertStoppedLocation('step', {})
12121206
]);
12131207

12141208
// Once the 'step' has completed, continue the program and
@@ -1220,21 +1214,11 @@ const testAll = (ctx: Mocha.Context, isDlvDap: boolean) => {
12201214
]);
12211215
}
12221216

1223-
test('should set breakpoints during continue', async function () {
1224-
if (!isDlvDap) {
1225-
this.skip();
1226-
}
1227-
await setBreakpointsWhileRunning(async () => {
1228-
const nextResponse = await dc.continueRequest({ threadId: 1 });
1229-
assert.ok(nextResponse.success);
1230-
});
1231-
});
1232-
12331217
test('should set breakpoints during next', async function () {
12341218
if (!isDlvDap) {
12351219
this.skip();
12361220
}
1237-
await setBreakpointsWhileRunning(async () => {
1221+
await setBreakpointsWhileRunningStep(async () => {
12381222
const nextResponse = await dc.nextRequest({ threadId: 1 });
12391223
assert.ok(nextResponse.success);
12401224
});
@@ -1245,7 +1229,9 @@ const testAll = (ctx: Mocha.Context, isDlvDap: boolean) => {
12451229
this.skip();
12461230
}
12471231

1248-
await setBreakpointsWhileRunning(async () => {
1232+
await setBreakpointsWhileRunningStep(async () => {
1233+
await Promise.all([dc.stepInRequest({ threadId: 1 }), dc.assertStoppedLocation('step', {})]);
1234+
12491235
const stepOutResponse = await dc.stepOutRequest({ threadId: 1 });
12501236
assert.ok(stepOutResponse.success);
12511237
});

0 commit comments

Comments
 (0)