diff options
Diffstat (limited to 'js/src/jit-test/tests/parser/lineNumber.js')
-rw-r--r-- | js/src/jit-test/tests/parser/lineNumber.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/parser/lineNumber.js b/js/src/jit-test/tests/parser/lineNumber.js new file mode 100644 index 0000000000..25ea40300b --- /dev/null +++ b/js/src/jit-test/tests/parser/lineNumber.js @@ -0,0 +1,30 @@ + +// Simple tests for evaluate's "lineNumber" option. + +load(libdir + 'asserts.js'); + +const maxLine = Math.pow(2,32) - 1; + +assertEq(evaluate("saveStack().line"), 1); +assertEq(evaluate("saveStack().line", { lineNumber: maxLine }), maxLine); +assertEq(evaluate("\nsaveStack().line"), 2); +assertEq(evaluate("\nsaveStack().line", { lineNumber: 1000 }), 1001); +assertThrowsInstanceOf(() => evaluate("\nsaveStack().line", { lineNumber: maxLine }), + RangeError); + +if (helperThreadCount() > 0) { + offThreadCompileScript("saveStack().line"); + assertEq(runOffThreadScript(), 1); + + offThreadCompileScript("saveStack().line", { lineNumber: maxLine }); + assertEq(runOffThreadScript(), maxLine); + + offThreadCompileScript("\nsaveStack().line"); + assertEq(runOffThreadScript(), 2); + + offThreadCompileScript("\nsaveStack().line", { lineNumber: 1000 }); + assertEq(runOffThreadScript(), 1001); + + offThreadCompileScript("\nsaveStack().line", { lineNumber: maxLine }); + assertThrowsInstanceOf(runOffThreadScript, RangeError); +} |