Add tests for debugging nested blocks and switch statements.
Change-Id: If3d7e222023efb957eba66adc1f9ca601c2ffd67 Bug: skia:13189 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528916 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
b79b801c50
commit
0b6e91f51e
@ -571,7 +571,6 @@ int main() { // Line 9
|
||||
REPORTER_ASSERT(r, make_global_vars_string(*trace, player) == "##[main].result = 44");
|
||||
}
|
||||
|
||||
|
||||
DEF_TEST(SkSLTracePlayerVariableScope, r) {
|
||||
sk_sp<SkSL::SkVMDebugTrace> trace = make_trace(r,
|
||||
R"( // Line 1
|
||||
@ -648,6 +647,69 @@ int main() { // Line 2
|
||||
REPORTER_ASSERT(r, player.traceHasCompleted());
|
||||
}
|
||||
|
||||
DEF_TEST(SkSLTracePlayerNestedBlocks, r) {
|
||||
sk_sp<SkSL::SkVMDebugTrace> trace = make_trace(r,
|
||||
R"( // Line 1
|
||||
int main() { // Line 2
|
||||
{{{{{{{ // Line 3
|
||||
int a, b; // Line 4
|
||||
}}}}}}} // Line 5
|
||||
return 0; // Line 6
|
||||
}
|
||||
)");
|
||||
SkSL::SkVMDebugTracePlayer player;
|
||||
player.reset(trace);
|
||||
player.step();
|
||||
|
||||
REPORTER_ASSERT(r, player.getCurrentLine() == 4);
|
||||
player.step();
|
||||
|
||||
REPORTER_ASSERT(r, player.getCurrentLine() == 6);
|
||||
player.step();
|
||||
|
||||
REPORTER_ASSERT(r, player.traceHasCompleted());
|
||||
}
|
||||
|
||||
DEF_TEST(SkSLTracePlayerSwitchStatement, r) {
|
||||
sk_sp<SkSL::SkVMDebugTrace> trace = make_trace(r,
|
||||
R"( // Line 1
|
||||
int main() { // Line 2
|
||||
int x = 2; // Line 3
|
||||
switch (x) { // Line 4
|
||||
case 1: // Line 5
|
||||
break; // Line 6
|
||||
case 2: // Line 7
|
||||
++x; // Line 8
|
||||
case 3: // Line 9
|
||||
break; // Line 10
|
||||
case 4: // Line 11
|
||||
} // Line 12
|
||||
return x; // Line 13
|
||||
}
|
||||
)");
|
||||
SkSL::SkVMDebugTracePlayer player;
|
||||
player.reset(trace);
|
||||
player.step();
|
||||
|
||||
REPORTER_ASSERT(r, player.getCurrentLine() == 3);
|
||||
player.step();
|
||||
|
||||
REPORTER_ASSERT(r, player.getCurrentLine() == 4);
|
||||
player.step();
|
||||
|
||||
// TODO(skia:13189): these lines are skipped in the debug trace
|
||||
// REPORTER_ASSERT(r, player.getCurrentLine() == 8);
|
||||
// player.step();
|
||||
|
||||
// REPORTER_ASSERT(r, player.getCurrentLine() == 10);
|
||||
// player.step();
|
||||
|
||||
REPORTER_ASSERT(r, player.getCurrentLine() == 13);
|
||||
player.step();
|
||||
|
||||
REPORTER_ASSERT(r, player.traceHasCompleted());
|
||||
}
|
||||
|
||||
DEF_TEST(SkSLTracePlayerBreakpoint, r) {
|
||||
sk_sp<SkSL::SkVMDebugTrace> trace = make_trace(r,
|
||||
R"( // Line 1
|
||||
|
Loading…
Reference in New Issue
Block a user