Skip to content

Commit

Permalink
Add function breakpoint tests
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Moran <[email protected]>
  • Loading branch information
thegecko committed Nov 2, 2019
1 parent e46403b commit 94beca4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
30 changes: 30 additions & 0 deletions src/integration-tests/breakpoints.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,34 @@ describe('breakpoints', async () => {
const vars = await dc.variablesRequest({ variablesReference: vr });
verifyVariable(vars.body.variables[0], 'count', 'int', '5');
});

it('hits the main function breakpoint', async () => {
await dc.setFunctionBreakpointsRequest({
breakpoints: [
{
name: 'main',
},
],
});
await dc.configurationDoneRequest();
const scope = await getScopes(dc);
const vr = scope.scopes.body.scopes[0].variablesReference;
const vars = await dc.variablesRequest({ variablesReference: vr });
verifyVariable(vars.body.variables[0], 'count', 'int', '0');
});

it('hits the sub function breakpoint', async () => {
await dc.setFunctionBreakpointsRequest({
breakpoints: [
{
name: 'sub',
},
],
});
await dc.configurationDoneRequest();
const scope = await getScopes(dc);
const vr = scope.scopes.body.scopes[0].variablesReference;
const vars = await dc.variablesRequest({ variablesReference: vr });
verifyVariable(vars.body.variables[0], 'variable', 'int', '0');
});
});
8 changes: 7 additions & 1 deletion src/integration-tests/test-programs/count.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ int main() {
while (count < 1000) {
count ++;
}
return 0;
int retval = sub();
return retval;
}

int sub() {
int variable = 0;
return variable;
}

0 comments on commit 94beca4

Please sign in to comment.