diff options
Diffstat (limited to 'js/src/jit-test/tests/basic/testSwitch.js')
-rw-r--r-- | js/src/jit-test/tests/basic/testSwitch.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/testSwitch.js b/js/src/jit-test/tests/basic/testSwitch.js new file mode 100644 index 0000000000..c2127d4a6c --- /dev/null +++ b/js/src/jit-test/tests/basic/testSwitch.js @@ -0,0 +1,25 @@ +function testSwitch() { + var x = 0; + var ret = 0; + for (var i = 0; i < 100; ++i) { + switch (x) { + case 0: + ret += 1; + break; + case 1: + ret += 2; + break; + case 2: + ret += 3; + break; + case 3: + ret += 4; + break; + default: + x = 0; + } + x++; + } + return ret; +} +assertEq(testSwitch(), 226); |