forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch-statements.js
30 lines (24 loc) · 977 Bytes
/
switch-statements.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted;
load("./driver/driver.js");
var a, b, c;
function testSwitch(s) {
switch (s) {
case "foo":
return a;
case "bar":
return b;
default:
return c;
}
}
assert(!hasBasicBlockExecuted(testSwitch, "switch"), "should not have executed yet.");
testSwitch("foo");
assert(hasBasicBlockExecuted(testSwitch, "switch"), "should have executed.");
assert(hasBasicBlockExecuted(testSwitch, "return a"), "should have executed.");
assert(!hasBasicBlockExecuted(testSwitch, "return b"), "should not have executed yet.");
assert(!hasBasicBlockExecuted(testSwitch, "return c"), "should not have executed yet.");
testSwitch("bar");
assert(hasBasicBlockExecuted(testSwitch, "return b"), "should have executed.");
assert(!hasBasicBlockExecuted(testSwitch, "return c"), "should not have executed yet.");
testSwitch("");
assert(hasBasicBlockExecuted(testSwitch, "return c"), "should have executed.");