summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/parser/bug1803036.js
blob: bb3e237990532e971172946d025806066de79a13 (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)
    }

    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