Skip to content

Commit 5aaf744

Browse files
thaystggithub-actions
authored andcommitted
Adding more tests as suggested by @radical.
1 parent da89542 commit 5aaf744

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,5 +472,110 @@ await SendCommandAndCheck(null, "Debugger.resume",
472472
bp_check.Value["locations"][0]["columnNumber"].Value<int>(),
473473
"LoopToBreak");
474474
}
475+
476+
[Fact]
477+
public async Task ConditionalBreakpointInALoopStopMoreThanOnce()
478+
{
479+
var bp_conditional = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 4, condition:"i % 3 == 0");
480+
var bp_check = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 5);
481+
await EvaluateAndCheck(
482+
"window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);",
483+
"dotnet://debugger-test.dll/debugger-test.cs",
484+
bp_conditional.Value["locations"][0]["lineNumber"].Value<int>(),
485+
bp_conditional.Value["locations"][0]["columnNumber"].Value<int>(),
486+
"LoopToBreak",
487+
locals_fn: (locals) =>
488+
{
489+
CheckNumber(locals, "i", 0);
490+
}
491+
);
492+
493+
await SendCommandAndCheck(null, "Debugger.resume",
494+
null,
495+
bp_conditional.Value["locations"][0]["lineNumber"].Value<int>(),
496+
bp_conditional.Value["locations"][0]["columnNumber"].Value<int>(),
497+
"LoopToBreak",
498+
locals_fn: (locals) =>
499+
{
500+
CheckNumber(locals, "i", 3);
501+
});
502+
503+
await SendCommandAndCheck(null, "Debugger.resume",
504+
null,
505+
bp_conditional.Value["locations"][0]["lineNumber"].Value<int>(),
506+
bp_conditional.Value["locations"][0]["columnNumber"].Value<int>(),
507+
"LoopToBreak",
508+
locals_fn: (locals) =>
509+
{
510+
CheckNumber(locals, "i", 6);
511+
});
512+
513+
await SendCommandAndCheck(null, "Debugger.resume",
514+
null,
515+
bp_conditional.Value["locations"][0]["lineNumber"].Value<int>(),
516+
bp_conditional.Value["locations"][0]["columnNumber"].Value<int>(),
517+
"LoopToBreak",
518+
locals_fn: (locals) =>
519+
{
520+
CheckNumber(locals, "i", 9);
521+
});
522+
523+
await SendCommandAndCheck(null, "Debugger.resume",
524+
null,
525+
bp_check.Value["locations"][0]["lineNumber"].Value<int>(),
526+
bp_check.Value["locations"][0]["columnNumber"].Value<int>(),
527+
"LoopToBreak");
528+
}
529+
530+
[Fact]
531+
public async Task ConditionalBreakpointNoStopInALoop()
532+
{
533+
var bp_conditional = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 4, condition:"i == \"10\"");
534+
var bp_check = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 5);
535+
await EvaluateAndCheck(
536+
"window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);",
537+
"dotnet://debugger-test.dll/debugger-test.cs",
538+
bp_check.Value["locations"][0]["lineNumber"].Value<int>(),
539+
bp_check.Value["locations"][0]["columnNumber"].Value<int>(),
540+
"LoopToBreak"
541+
);
542+
}
543+
544+
[Fact]
545+
public async Task ConditionalBreakpointNotBooleanInALoop()
546+
{
547+
var bp_conditional = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 4, condition:"i + 4");
548+
await EvaluateAndCheck(
549+
"window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);",
550+
"dotnet://debugger-test.dll/debugger-test.cs",
551+
bp_conditional.Value["locations"][0]["lineNumber"].Value<int>(),
552+
bp_conditional.Value["locations"][0]["columnNumber"].Value<int>(),
553+
"LoopToBreak",
554+
locals_fn: (locals) =>
555+
{
556+
CheckNumber(locals, "i", 0);
557+
}
558+
);
559+
560+
await SendCommandAndCheck(null, "Debugger.resume",
561+
null,
562+
bp_conditional.Value["locations"][0]["lineNumber"].Value<int>(),
563+
bp_conditional.Value["locations"][0]["columnNumber"].Value<int>(),
564+
"LoopToBreak",
565+
locals_fn: (locals) =>
566+
{
567+
CheckNumber(locals, "i", 1);
568+
});
569+
570+
await SendCommandAndCheck(null, "Debugger.resume",
571+
null,
572+
bp_conditional.Value["locations"][0]["lineNumber"].Value<int>(),
573+
bp_conditional.Value["locations"][0]["columnNumber"].Value<int>(),
574+
"LoopToBreak",
575+
locals_fn: (locals) =>
576+
{
577+
CheckNumber(locals, "i", 2);
578+
});
579+
}
475580
}
476581
}

0 commit comments

Comments
 (0)