syntax-error-function-body-eof.js (270B)
1 var caught = false; 2 try { 3 new Function("switch (x) {} }"); 4 } catch (e) { 5 assertEq(e instanceof SyntaxError, true); 6 assertEq(e.message.startsWith("unexpected garbage after function body, starting with '}'") == -1, false); 7 caught = true; 8 } 9 assertEq(caught, true);