Skip to content

Commit 41892ae

Browse files
authored
Add tests for hit count breakpoints for the experimental debugger (microsoft#1584)
1 parent 8028931 commit 41892ae

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

‎news/3 Code Health/1410.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add tests for hit count breakpoints for the experimental debugger.

‎src/test/debugger/misc.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,5 +634,33 @@ let testCounter = 0;
634634
debugClient.waitForEvent('terminated')
635635
]);
636636
});
637+
test('Test Hit Count Breakpoints', async function () {
638+
if (debuggerType !== 'pythonExperimental') {
639+
return this.skip();
640+
}
641+
642+
const breakpointLocation = { path: path.join(debugFilesPath, 'loopyTest.py'), column: 1, line: 2 };
643+
const breakpointArgs: DebugProtocol.SetBreakpointsArguments = {
644+
lines: [breakpointLocation.line],
645+
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column, hitCondition: '5' }],
646+
source: { path: breakpointLocation.path }
647+
};
648+
await Promise.all([
649+
debugClient.launch(buildLaunchArgs('loopyTest.py', false)),
650+
debugClient.waitForEvent('initialized')
651+
.then(() => debugClient.setBreakpointsRequest(breakpointArgs))
652+
.then(() => debugClient.configurationDoneRequest())
653+
.then(() => debugClient.threadsRequest()),
654+
debugClient.waitForEvent('thread'),
655+
debugClient.assertStoppedLocation('breakpoint', breakpointLocation)
656+
]);
657+
658+
//Do not remove this, this is required to ensure PTVSD is ready to accept other requests.
659+
await debugClient.threadsRequest();
660+
const evaluateResponse = await debugClient.evaluateRequest({ context: 'repl', expression: 'i', frameId: 1 });
661+
expect(evaluateResponse.body.type).to.equal('int');
662+
expect(evaluateResponse.body.result).to.equal('4');
663+
await continueDebugging(debugClient);
664+
});
637665
});
638666
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
for i in range(10):
2+
print(i)

0 commit comments

Comments
 (0)