blob: f6a606dc1958e36ffa9bfee72391b105848fc7ef [file] [log] [blame]
cwzwarich@webkit.org1188ff02008-12-31 00:07:20 +00001description(
2"This test checks that automatic semicolon insertion for parsing and reparsing agree. In a debug build, this test will fail with an assertion failure if they do not."
3);
4
5// According to the ECMA spec, these should all be syntax errors. However, the
6// pre-existing behaviour of JavaScriptCore has always been to accept them. If
7// JavaScriptCore is changed so that these are syntax errors in the future, then
8// this test can simply be changed to reflect that.
9
10// It is important that the closing braces be on the same line as the commas, so
11// that a newline doesn't act as a terminator when lexing inbetween.
12
oliver@apple.coma2139012010-06-24 05:50:23 +000013function commaTest() { a = 1 }
cwzwarich@webkit.org1188ff02008-12-31 00:07:20 +000014
15shouldBeUndefined("commaTest()");
16
oliver@apple.coma2139012010-06-24 05:50:23 +000017function varCommaTest() { var a = 1 }
cwzwarich@webkit.org1188ff02008-12-31 00:07:20 +000018
19shouldBeUndefined("varCommaTest()");
20
oliver@apple.coma2139012010-06-24 05:50:23 +000021function constCommaTest() { const a = 1 }
cwzwarich@webkit.org1188ff02008-12-31 00:07:20 +000022
23shouldBeUndefined("constCommaTest()");
24
oliver@apple.coma2139012010-06-24 05:50:23 +000025function commaParenTest() { (1) }
oliver@apple.com878dfc02009-01-22 21:07:14 +000026
27shouldBeUndefined("commaParenTest()");
28
oliver@apple.coma2139012010-06-24 05:50:23 +000029function commaParenThrowTest() { (x) }
oliver@apple.com878dfc02009-01-22 21:07:14 +000030
31shouldThrow("commaParenThrowTest()");