blob: 4bb796810febdb9ef549c3cdef11fbdd317abe20 [file] [log] [blame]
utatane.tea@gmail.com94099c32016-04-30 20:05:13 +00001function testSyntaxError(script, message) {
2 var error = null;
3 try {
4 eval(script);
5 } catch (e) {
6 error = e;
7 }
8 if (!error)
9 throw new Error("Expected syntax error not thrown");
10
11 if (String(error) !== message)
12 throw new Error("Bad error: " + String(error));
13}
14
15
16testSyntaxError(`
17function f()
18{
19 ({v = (typeof new.target)} = {})
20}
21`, `SyntaxError: Unexpected token '='. Expected a ':' following the property name 'v'.`);