diff options
Diffstat (limited to 'js/src/jit-test/tests/jaeger/testTableSwitchX.js')
-rw-r--r-- | js/src/jit-test/tests/jaeger/testTableSwitchX.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/jaeger/testTableSwitchX.js b/js/src/jit-test/tests/jaeger/testTableSwitchX.js new file mode 100644 index 000000000..c92d4c275 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testTableSwitchX.js @@ -0,0 +1,25 @@ +// Tests for JSOP_TABLESWITCHX. +function test1() { + var src = + "var a = 0;\n" + + "switch(x) {\n"; + for (var i=-1; i<4; i++) { + src += (i >= 0) ? + "case " + i + ":\n" : + "default:\n"; + for (var j=0; j<1500; j++) { + src += "a = " + i + ";"; + } + src += "break;\n"; + } + src += "}\n"; + src += "return a;"; + + var f = new Function("x", src); + assertEq(f(0), 0); + assertEq(f(4), -1); + assertEq(f(), -1); + assertEq(f(1.1), -1); + assertEq(f(3), 3); +} +test1(); |