summaryrefslogtreecommitdiff
path: root/js/src/jit-test/tests/parser/missing-closing-brace.js
blob: 4512ad133d3bbd20f55f3515aa4eabca0f1e55e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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]);