blob: 006d7168bee8588d32096a2b3d2bce59591ef6c6 [file] [log] [blame]
function testSyntaxError(script, message) {
var error = null;
try {
eval(script);
} catch (e) {
error = e;
}
if (!error)
throw new Error("Expected syntax error not thrown");
if (String(error) !== message)
throw new Error(`Bad error: ${String(error)}`);
}
testSyntaxError(String.raw`
var { bre\u0061k } = { break: 42 };
`, `SyntaxError: Cannot use abbreviated destructuring syntax for keyword 'break'.`);
testSyntaxError(String.raw`
var { break: bre\u0061k } = { break: 42 };
`, String.raw`SyntaxError: Unexpected escaped characters in keyword token: 'bre\u0061k'`);