cwzwarich@webkit.org | 1188ff0 | 2008-12-31 00:07:20 +0000 | [diff] [blame] | 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 | ); |
| 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.com | a213901 | 2010-06-24 05:50:23 +0000 | [diff] [blame] | 13 | function commaTest() { a = 1 } |
cwzwarich@webkit.org | 1188ff0 | 2008-12-31 00:07:20 +0000 | [diff] [blame] | 14 | |
| 15 | shouldBeUndefined("commaTest()"); |
| 16 | |
oliver@apple.com | a213901 | 2010-06-24 05:50:23 +0000 | [diff] [blame] | 17 | function varCommaTest() { var a = 1 } |
cwzwarich@webkit.org | 1188ff0 | 2008-12-31 00:07:20 +0000 | [diff] [blame] | 18 | |
| 19 | shouldBeUndefined("varCommaTest()"); |
| 20 | |
oliver@apple.com | a213901 | 2010-06-24 05:50:23 +0000 | [diff] [blame] | 21 | function constCommaTest() { const a = 1 } |
cwzwarich@webkit.org | 1188ff0 | 2008-12-31 00:07:20 +0000 | [diff] [blame] | 22 | |
| 23 | shouldBeUndefined("constCommaTest()"); |
| 24 | |
oliver@apple.com | a213901 | 2010-06-24 05:50:23 +0000 | [diff] [blame] | 25 | function commaParenTest() { (1) } |
oliver@apple.com | 878dfc0 | 2009-01-22 21:07:14 +0000 | [diff] [blame] | 26 | |
| 27 | shouldBeUndefined("commaParenTest()"); |
| 28 | |
oliver@apple.com | a213901 | 2010-06-24 05:50:23 +0000 | [diff] [blame] | 29 | function commaParenThrowTest() { (x) } |
oliver@apple.com | 878dfc0 | 2009-01-22 21:07:14 +0000 | [diff] [blame] | 30 | |
| 31 | shouldThrow("commaParenThrowTest()"); |