diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-07-14 10:15:10 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:43 -0400 |
commit | ccb322db6d1f14c3013bacb01dcb064a3f7fa28f (patch) | |
tree | 31d99375ece8cdadb53154a62524d87c7bad4837 /js/src/jit-test | |
parent | 03df00e45ff4dd24b739a973d56edaf800313f7f (diff) | |
download | UXP-ccb322db6d1f14c3013bacb01dcb064a3f7fa28f.tar UXP-ccb322db6d1f14c3013bacb01dcb064a3f7fa28f.tar.gz UXP-ccb322db6d1f14c3013bacb01dcb064a3f7fa28f.tar.lz UXP-ccb322db6d1f14c3013bacb01dcb064a3f7fa28f.tar.xz UXP-ccb322db6d1f14c3013bacb01dcb064a3f7fa28f.zip |
420857 - Part 1: Report the position of opening brace for missing brace error in function body.
Diffstat (limited to 'js/src/jit-test')
-rw-r--r-- | js/src/jit-test/tests/parser/missing-closing-brace.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/parser/missing-closing-brace.js b/js/src/jit-test/tests/parser/missing-closing-brace.js new file mode 100644 index 000000000..4512ad133 --- /dev/null +++ b/js/src/jit-test/tests/parser/missing-closing-brace.js @@ -0,0 +1,30 @@ +function test(source, [lineNumber, columnNumber]) { + let caught = false; + try { + Reflect.parse(source, { source: "foo.js" }); + } catch (e) { + assertEq(e.message.includes("missing } "), true); + let notes = getErrorNotes(e); + assertEq(notes.length, 1); + let note = notes[0]; + assertEq(note.message, "{ opened at line " + lineNumber + ", column " + columnNumber); + assertEq(note.fileName, "foo.js"); + assertEq(note.lineNumber, lineNumber); + assertEq(note.columnNumber, columnNumber); + caught = true; + } + assertEq(caught, true); +} + +// Function + +test(` +function test1() { +} +function test2() { + if (true) { + //} +} +function test3() { +} +`, [4, 17]); |