Debian Codegraph @

js/src/jit-test/tests/parser/bug1803036.js

raw
1 // Test that parsing the given source text will throw an error with location set
2 // to last character in source, rather than after it.
3 function testErrorPosition(src) {
4 let failed = false;
5
6 try {
7 parse(src)
8 }
9 catch (e) {
10 failed = true;
11 assertEq(e.lineNumber, 1)
12 assertEq(e.columnNumber, src.length)
13 }
14
15 assertEq(failed, true);
16 }
17
18 testErrorPosition("0_") // No trailing separator - Zero
19 testErrorPosition("00_") // No trailing separator - Octal
20 testErrorPosition("1_") // No trailing separator - Number
21 testErrorPosition("1__") // No repeated separator
22 testErrorPosition("00n") // No octal BigInt