summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/js/script-tests/reparsing-semicolon-insertion.js
blob: f6a606dc1958e36ffa9bfee72391b105848fc7ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
description(
"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."
);

// According to the ECMA spec, these should all be syntax errors. However, the
// pre-existing behaviour of JavaScriptCore has always been to accept them. If
// JavaScriptCore is changed so that these are syntax errors in the future, then
// this test can simply be changed to reflect that.

// It is important that the closing braces be on the same line as the commas, so
// that a newline doesn't act as a terminator when lexing inbetween.

function commaTest() { a = 1 }

shouldBeUndefined("commaTest()");

function varCommaTest() { var a = 1 }

shouldBeUndefined("varCommaTest()");

function constCommaTest() { const a = 1 }

shouldBeUndefined("constCommaTest()");

function commaParenTest() { (1) }

shouldBeUndefined("commaParenTest()");

function commaParenThrowTest() { (x) }

shouldThrow("commaParenThrowTest()");