summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/syntax-error-function-body-eof.js
blob: 7015f83b1094a583fb8ce3d1493a160fde2856b6 (plain)
1
2
3
4
5
6
7
8
9
var caught = false;
try {
  new Function("switch (x) {} }");
} catch (e) {
  assertEq(e instanceof SyntaxError, true);
  assertEq(e.message.startsWith("unexpected garbage after function body, starting with '}'") == -1, false);
  caught = true;
}
assertEq(caught, true);