mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
LibJS: Make "break" actually work inside "switch"
This commit is contained in:
parent
9d099835f9
commit
e3b92caa6d
3 changed files with 33 additions and 1 deletions
25
Libraries/LibJS/Tests/switch-break.js
Normal file
25
Libraries/LibJS/Tests/switch-break.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
function assert(x) { if (!x) throw 1; }
|
||||
|
||||
try {
|
||||
var i = 0;
|
||||
var three;
|
||||
var five;
|
||||
|
||||
for (; i < 9; ) {
|
||||
switch (i) {
|
||||
case 3:
|
||||
three = i;
|
||||
break;
|
||||
case 5:
|
||||
five = i;
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
assert(three === 3);
|
||||
assert(five === 5);
|
||||
|
||||
console.log("PASS");
|
||||
} catch {
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue