summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/parser/bug1803036.js
blob: f1ab09a1c6999298a1655f064c07ac31e3f8b08c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Test that parsing the given source text will throw an error with location set
// to last character in source, rather than after it.
function testErrorPosition(src) {
    let failed = false;

    try {
        parse(src)
    }
    catch (e) {
        failed = true;
        assertEq(e.lineNumber, 1)
        assertEq(e.columnNumber, src.length - 1)
    }

    assertEq(failed, true);
}

testErrorPosition("0_")  // No trailing separator - Zero
testErrorPosition("00_") // No trailing separator - Octal
testErrorPosition("1_")  // No trailing separator - Number
testErrorPosition("1__") // No repeated separator
testErrorPosition("00n") // No octal BigInt