summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/parser/missing-closing-brace.js
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-07-14 10:26:41 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:44 -0400
commite93a48121a1a14ac228bebe362e7c27b1aadd4d5 (patch)
tree17bcc3a4a237a8524759f919f18310ca4e6278a6 /js/src/jit-test/tests/parser/missing-closing-brace.js
parent10227d77bfccda845a63e20b22bc4367ecc7b4e0 (diff)
downloadUXP-e93a48121a1a14ac228bebe362e7c27b1aadd4d5.tar
UXP-e93a48121a1a14ac228bebe362e7c27b1aadd4d5.tar.gz
UXP-e93a48121a1a14ac228bebe362e7c27b1aadd4d5.tar.lz
UXP-e93a48121a1a14ac228bebe362e7c27b1aadd4d5.tar.xz
UXP-e93a48121a1a14ac228bebe362e7c27b1aadd4d5.zip
420857 - Part 4: Report the position of opening bracket for missing bracket error in array literal.
Diffstat (limited to 'js/src/jit-test/tests/parser/missing-closing-brace.js')
-rw-r--r--js/src/jit-test/tests/parser/missing-closing-brace.js13
1 files changed, 10 insertions, 3 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
index f97cefd81..6820954ae 100644
--- a/js/src/jit-test/tests/parser/missing-closing-brace.js
+++ b/js/src/jit-test/tests/parser/missing-closing-brace.js
@@ -1,13 +1,13 @@
-function test(source, [lineNumber, columnNumber]) {
+function test(source, [lineNumber, columnNumber], openType = "{", closeType = "}") {
let caught = false;
try {
Reflect.parse(source, { source: "foo.js" });
} catch (e) {
- assertEq(e.message.includes("missing } "), true);
+ assertEq(e.message.includes("missing " + closeType + " "), true);
let notes = getErrorNotes(e);
assertEq(notes.length, 1);
let note = notes[0];
- assertEq(note.message, "{ opened at line " + lineNumber + ", column " + columnNumber);
+ assertEq(note.message, openType + " opened at line " + lineNumber + ", column " + columnNumber);
assertEq(note.fileName, "foo.js");
assertEq(note.lineNumber, lineNumber);
assertEq(note.columnNumber, columnNumber);
@@ -81,3 +81,10 @@ var x = {
foo: {
};
`, [2, 8]);
+
+// Array literal.
+test(`
+var x = [
+ [
+];
+`, [2, 8], "[", "]");