Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / reparsing-semicolon-insertion.js
blobf6a606dc1958e36ffa9bfee72391b105848fc7ef
1 description(
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 );
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.
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.
13 function commaTest() { a = 1 }
15 shouldBeUndefined("commaTest()");
17 function varCommaTest() { var a = 1 }
19 shouldBeUndefined("varCommaTest()");
21 function constCommaTest() { const a = 1 }
23 shouldBeUndefined("constCommaTest()");
25 function commaParenTest() { (1) }
27 shouldBeUndefined("commaParenTest()");
29 function commaParenThrowTest() { (x) }
31 shouldThrow("commaParenThrowTest()");