blob: 8bab89ad11881f6e9cef57ccbe70e8767da3caae [file] [log] [blame]
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This test checks that the following expressions or statements are valid ECMASCRIPT code or should throw parse error
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Unary operators and member access
PASS Valid: ""
PASS Valid: "function f() { }"
PASS Invalid: "(a"
PASS Invalid: "function f() { (a }"
PASS Invalid: "a[5"
PASS Invalid: "function f() { a[5 }"
PASS Invalid: "a[5 + 6"
PASS Invalid: "function f() { a[5 + 6 }"
PASS Invalid: "a."
PASS Invalid: "function f() { a. }"
PASS Invalid: "()"
PASS Invalid: "function f() { () }"
PASS Invalid: "a.'l'"
PASS Invalid: "function f() { a.'l' }"
PASS Valid: "a: +~!new a"
PASS Valid: "function f() { a: +~!new a }"
PASS Invalid: "new -a"
PASS Invalid: "function f() { new -a }"
PASS Valid: "new (-1)"
PASS Valid: "function f() { new (-1) }"
PASS Invalid: "a: b: c: new f(x++)++"
PASS Invalid: "function f() { a: b: c: new f(x++)++ }"
PASS Valid: "(a)++"
PASS Valid: "function f() { (a)++ }"
PASS Invalid: "(1--).x"
PASS Invalid: "function f() { (1--).x }"
PASS Invalid: "a-- ++"
PASS Invalid: "function f() { a-- ++ }"
PASS Invalid: "(a:) --b"
PASS Invalid: "function f() { (a:) --b }"
PASS Invalid: "++ -- ++ a"
PASS Invalid: "function f() { ++ -- ++ a }"
PASS Invalid: "++ new new a ++"
PASS Invalid: "function f() { ++ new new a ++ }"
PASS Valid: "delete void 0"
PASS Valid: "function f() { delete void 0 }"
PASS Invalid: "delete the void"
PASS Invalid: "function f() { delete the void }"
PASS Invalid: "(a++"
PASS Invalid: "function f() { (a++ }"
PASS Invalid: "++a--"
PASS Invalid: "function f() { ++a-- }"
PASS Invalid: "++((a))--"
PASS Invalid: "function f() { ++((a))-- }"
PASS Invalid: "(a.x++)++"
PASS Invalid: "function f() { (a.x++)++ }"
PASS Invalid: "1: null"
PASS Invalid: "function f() { 1: null }"
PASS Invalid: "+-!~"
PASS Invalid: "function f() { +-!~ }"
PASS Invalid: "+-!~(("
PASS Invalid: "function f() { +-!~(( }"
PASS Invalid: "a)"
PASS Invalid: "function f() { a) }"
PASS Invalid: "a]"
PASS Invalid: "function f() { a] }"
PASS Invalid: ".l"
PASS Invalid: "function f() { .l }"
PASS Invalid: "1.l"
PASS Invalid: "function f() { 1.l }"
PASS Valid: "1 .l"
PASS Valid: "function f() { 1 .l }"
Binary and conditional operators
PASS Valid: "a + + typeof this"
PASS Valid: "function f() { a + + typeof this }"
PASS Invalid: "a + * b"
PASS Invalid: "function f() { a + * b }"
PASS Invalid: "a ? b"
PASS Invalid: "function f() { a ? b }"
PASS Invalid: "a ? b :"
PASS Invalid: "function f() { a ? b : }"
PASS Invalid: "%a"
PASS Invalid: "function f() { %a }"
PASS Invalid: "a-"
PASS Invalid: "function f() { a- }"
PASS Valid: "a = b ? b = c : d = e"
PASS Valid: "function f() { a = b ? b = c : d = e }"
PASS Valid: "s: a[1].l ? b.l['s'] ? c++ : d : true"
PASS Valid: "function f() { s: a[1].l ? b.l['s'] ? c++ : d : true }"
PASS Valid: "a ? b + 1 ? c + 3 * d.l : d[5][6] : e"
PASS Valid: "function f() { a ? b + 1 ? c + 3 * d.l : d[5][6] : e }"
PASS Valid: "a in b instanceof delete -c"
PASS Valid: "function f() { a in b instanceof delete -c }"
PASS Invalid: "a in instanceof b.l"
PASS Invalid: "function f() { a in instanceof b.l }"
PASS Valid: "- - true % 5"
PASS Valid: "function f() { - - true % 5 }"
PASS Invalid: "- false = 3"
PASS Invalid: "function f() { - false = 3 }"
PASS Invalid: "a: b: c: (1 + null) = 3"
PASS Invalid: "function f() { a: b: c: (1 + null) = 3 }"
PASS Valid: "a[2] = b.l += c /= 4 * 7 ^ !6"
PASS Valid: "function f() { a[2] = b.l += c /= 4 * 7 ^ !6 }"
PASS Invalid: "a + typeof b += c in d"
PASS Invalid: "function f() { a + typeof b += c in d }"
PASS Invalid: "typeof a &= typeof b"
PASS Invalid: "function f() { typeof a &= typeof b }"
PASS Invalid: "a: ((typeof (a))) >>>= a || b.l && c"
PASS Invalid: "function f() { a: ((typeof (a))) >>>= a || b.l && c }"
PASS Valid: "a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g"
PASS Valid: "function f() { a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g }"
PASS Valid: "-void+x['y'].l == x.l != 5 - f[7]"
PASS Valid: "function f() { -void+x['y'].l == x.l != 5 - f[7] }"
Function calls (and new with arguments)
PASS Valid: "a()()()"
PASS Valid: "function f() { a()()() }"
PASS Invalid: "s: l: a[2](4 == 6, 5 = 6)(f[4], 6)"
PASS Invalid: "function f() { s: l: a[2](4 == 6, 5 = 6)(f[4], 6) }"
PASS Valid: "s: eval(a.apply(), b.call(c[5] - f[7]))"
PASS Valid: "function f() { s: eval(a.apply(), b.call(c[5] - f[7])) }"
PASS Invalid: "a("
PASS Invalid: "function f() { a( }"
PASS Invalid: "a(5"
PASS Invalid: "function f() { a(5 }"
PASS Invalid: "a(5,"
PASS Invalid: "function f() { a(5, }"
PASS Valid: "a(5,)"
PASS Valid: "function f() { a(5,) }"
PASS Invalid: "a(5,6"
PASS Invalid: "function f() { a(5,6 }"
PASS Valid: "a(b[7], c <d> e.l, new a() > b)"
PASS Valid: "function f() { a(b[7], c <d> e.l, new a() > b) }"
PASS Invalid: "a(b[5)"
PASS Invalid: "function f() { a(b[5) }"
PASS Invalid: "a(b.)"
PASS Invalid: "function f() { a(b.) }"
PASS Valid: "~new new a(1)(i++)(c[l])"
PASS Valid: "function f() { ~new new a(1)(i++)(c[l]) }"
PASS Invalid: "a(*a)"
PASS Invalid: "function f() { a(*a) }"
PASS Valid: "((((a))((b)()).l))()"
PASS Valid: "function f() { ((((a))((b)()).l))() }"
PASS Valid: "(a)[b + (c) / (d())].l--"
PASS Valid: "function f() { (a)[b + (c) / (d())].l-- }"
PASS Valid: "new (5)"
PASS Valid: "function f() { new (5) }"
PASS Invalid: "new a(5"
PASS Invalid: "function f() { new a(5 }"
PASS Valid: "new (f + 5)(6, (g)() - 'l'() - true(false))"
PASS Valid: "function f() { new (f + 5)(6, (g)() - 'l'() - true(false)) }"
PASS Invalid: "a(.length)"
PASS Invalid: "function f() { a(.length) }"
function declaration and expression
PASS Valid: "function f() {}"
PASS Valid: "function f() { function f() {} }"
PASS Valid: "function f(a,b) {}"
PASS Valid: "function f() { function f(a,b) {} }"
PASS Invalid: "function () {}"
PASS Invalid: "function f() { function () {} }"
PASS Invalid: "function f(a b) {}"
PASS Invalid: "function f() { function f(a b) {} }"
PASS Valid: "function f(a,) {}"
PASS Valid: "function f() { function f(a,) {} }"
PASS Invalid: "function f(a,"
PASS Invalid: "function f() { function f(a, }"
PASS Invalid: "function f(a, 1) {}"
PASS Invalid: "function f() { function f(a, 1) {} }"
PASS Valid: "function g(arguments, eval) {}"
PASS Valid: "function f() { function g(arguments, eval) {} }"
PASS Valid: "function f() {} + function g() {}"
PASS Valid: "function f() { function f() {} + function g() {} }"
PASS Invalid: "(function a{})"
PASS Invalid: "function f() { (function a{}) }"
PASS Invalid: "(function this(){})"
PASS Invalid: "function f() { (function this(){}) }"
PASS Valid: "(delete new function f(){} + function(a,b){}(5)(6))"
PASS Valid: "function f() { (delete new function f(){} + function(a,b){}(5)(6)) }"
PASS Valid: "6 - function (m) { function g() {} }"
PASS Valid: "function f() { 6 - function (m) { function g() {} } }"
PASS Invalid: "function l() {"
PASS Invalid: "function f() { function l() { }"
PASS Invalid: "function l++(){}"
PASS Invalid: "function f() { function l++(){} }"
Array and object literal, comma operator
PASS Valid: "[] in [5,6] * [,5,] / [,,5,,] || [a,] && new [,b] % [,,]"
PASS Valid: "function f() { [] in [5,6] * [,5,] / [,,5,,] || [a,] && new [,b] % [,,] }"
PASS Invalid: "[5,"
PASS Invalid: "function f() { [5, }"
PASS Invalid: "[,"
PASS Invalid: "function f() { [, }"
PASS Invalid: "(a,)"
PASS Invalid: "function f() { (a,) }"
PASS Valid: "1 + {get get(){}, set set(a){}, get1:4, set1:get-set, }"
PASS Valid: "function f() { 1 + {get get(){}, set set(a){}, get1:4, set1:get-set, } }"
PASS Invalid: "1 + {a"
PASS Invalid: "function f() { 1 + {a }"
PASS Invalid: "1 + {a:"
PASS Invalid: "function f() { 1 + {a: }"
PASS Invalid: "1 + {get l("
PASS Invalid: "function f() { 1 + {get l( }"
PASS Invalid: ",a"
PASS Invalid: "function f() { ,a }"
PASS Valid: "(4,(5,a(3,4))),f[4,a-6]"
PASS Valid: "function f() { (4,(5,a(3,4))),f[4,a-6] }"
PASS Invalid: "(,f)"
PASS Invalid: "function f() { (,f) }"
PASS Invalid: "a,,b"
PASS Invalid: "function f() { a,,b }"
PASS Invalid: "a ? b, c : d"
PASS Invalid: "function f() { a ? b, c : d }"
simple statements
PASS Valid: "{ }"
PASS Valid: "function f() { { } }"
PASS Invalid: "{ { }"
PASS Invalid: "function f() { { { } }"
PASS Valid: "{ ; ; ; }"
PASS Valid: "function f() { { ; ; ; } }"
PASS Valid: "a: { ; }"
PASS Valid: "function f() { a: { ; } }"
PASS Invalid: "{ a: }"
PASS Invalid: "function f() { { a: } }"
PASS Valid: "{} f; { 6 + f() }"
PASS Valid: "function f() { {} f; { 6 + f() } }"
PASS Valid: "{ a[5],6; {} ++b-new (-5)() } c().l++"
PASS Valid: "function f() { { a[5],6; {} ++b-new (-5)() } c().l++ }"
PASS Valid: "{ l1: l2: l3: { this } a = 32 ; { i++ ; { { { } } ++i } } }"
PASS Valid: "function f() { { l1: l2: l3: { this } a = 32 ; { i++ ; { { { } } ++i } } } }"
PASS Valid: "if (a) ;"
PASS Valid: "function f() { if (a) ; }"
PASS Invalid: "{ if (a) }"
PASS Invalid: "function f() { { if (a) } }"
PASS Invalid: "if a {}"
PASS Invalid: "function f() { if a {} }"
PASS Invalid: "if (a"
PASS Invalid: "function f() { if (a }"
PASS Invalid: "if (a { }"
PASS Invalid: "function f() { if (a { } }"
PASS Valid: "x: s: if (a) ; else b"
PASS Valid: "function f() { x: s: if (a) ; else b }"
PASS Invalid: "else {}"
PASS Invalid: "function f() { else {} }"
PASS Valid: "if (a) if (b) y; else {} else ;"
PASS Valid: "function f() { if (a) if (b) y; else {} else ; }"
PASS Invalid: "if (a) {} else x; else"
PASS Invalid: "function f() { if (a) {} else x; else }"
PASS Invalid: "if (a) { else }"
PASS Invalid: "function f() { if (a) { else } }"
PASS Valid: "if (a.l + new b()) 4 + 5 - f()"
PASS Valid: "function f() { if (a.l + new b()) 4 + 5 - f() }"
PASS Valid: "if (a) with (x) ; else with (y) ;"
PASS Valid: "function f() { if (a) with (x) ; else with (y) ; }"
PASS Invalid: "with a.b { }"
PASS Invalid: "function f() { with a.b { } }"
PASS Valid: "while (a() - new b) ;"
PASS Valid: "function f() { while (a() - new b) ; }"
PASS Invalid: "while a {}"
PASS Invalid: "function f() { while a {} }"
PASS Valid: "do ; while(0) i++"
PASS Valid: "function f() { do ; while(0) i++ }"
PASS Valid: "do if (a) x; else y; while(z)"
PASS Valid: "function f() { do if (a) x; else y; while(z) }"
PASS Invalid: "do g; while 4"
PASS Invalid: "function f() { do g; while 4 }"
PASS Invalid: "do g; while ((4)"
PASS Invalid: "function f() { do g; while ((4) }"
PASS Valid: "{ { do do do ; while(0) while(0) while(0) } }"
PASS Valid: "function f() { { { do do do ; while(0) while(0) while(0) } } }"
PASS Valid: "do while (0) if (a) {} else y; while(0)"
PASS Valid: "function f() { do while (0) if (a) {} else y; while(0) }"
PASS Valid: "if (a) while (b) if (c) with(d) {} else e; else f"
PASS Valid: "function f() { if (a) while (b) if (c) with(d) {} else e; else f }"
PASS Invalid: "debugger X"
PASS Invalid: "function f() { debugger X }"
PASS Invalid: "break 0.2"
PASS Invalid: "function f() { break 0.2 }"
PASS Invalid: "continue a++"
PASS Invalid: "function f() { continue a++ }"
PASS Invalid: "continue (my_friend)"
PASS Invalid: "function f() { continue (my_friend) }"
PASS Valid: "while (1) break"
PASS Valid: "function f() { while (1) break }"
PASS Valid: "do if (a) with (b) continue; else debugger; while (false)"
PASS Valid: "function f() { do if (a) with (b) continue; else debugger; while (false) }"
PASS Invalid: "do if (a) while (false) else debugger"
PASS Invalid: "function f() { do if (a) while (false) else debugger }"
PASS Invalid: "while if (a) ;"
PASS Invalid: "function f() { while if (a) ; }"
PASS Valid: "if (a) function f() {} else function g() {}"
PASS Valid: "function f() { if (a) function f() {} else function g() {} }"
PASS Invalid: "if (a()) while(0) function f() {} else function g() {}"
PASS Invalid: "function f() { if (a()) while(0) function f() {} else function g() {} }"
PASS Invalid: "if (a()) function f() { else function g() }"
PASS Invalid: "function f() { if (a()) function f() { else function g() } }"
PASS Invalid: "if (a) if (b) ; else function f {}"
PASS Invalid: "function f() { if (a) if (b) ; else function f {} }"
PASS Invalid: "if (a) if (b) ; else function (){}"
PASS Invalid: "function f() { if (a) if (b) ; else function (){} }"
PASS Valid: "throw a"
PASS Valid: "function f() { throw a }"
PASS Valid: "throw a + b in void c"
PASS Valid: "function f() { throw a + b in void c }"
PASS Invalid: "throw"
PASS Invalid: "function f() { throw }"
var and const statements
PASS Valid: "var a, b = null"
PASS Valid: "function f() { var a, b = null }"
FAIL Valid: "const a = 5, b, c" should NOT throw
FAIL Valid: "function f() { const a = 5, b, c }" should NOT throw
PASS Invalid: "var"
PASS Invalid: "function f() { var }"
PASS Invalid: "var = 7"
PASS Invalid: "function f() { var = 7 }"
PASS Invalid: "var c (6)"
PASS Invalid: "function f() { var c (6) }"
FAIL Valid: "if (a) var a,b; else const b, c" should NOT throw
FAIL Valid: "function f() { if (a) var a,b; else const b, c }" should NOT throw
PASS Invalid: "var 5 = 6"
PASS Invalid: "function f() { var 5 = 6 }"
PASS Valid: "while (0) var a, b, c=6, d, e, f=5*6, g=f*h, h"
PASS Valid: "function f() { while (0) var a, b, c=6, d, e, f=5*6, g=f*h, h }"
PASS Invalid: "var a = if (b) { c }"
PASS Invalid: "function f() { var a = if (b) { c } }"
PASS Invalid: "var a = var b"
PASS Invalid: "function f() { var a = var b }"
PASS Invalid: "const a = b += c, a, a, a = (b - f())"
PASS Invalid: "function f() { const a = b += c, a, a, a = (b - f()) }"
PASS Invalid: "var a %= b | 5"
PASS Invalid: "function f() { var a %= b | 5 }"
PASS Invalid: "var (a) = 5"
PASS Invalid: "function f() { var (a) = 5 }"
PASS Invalid: "var a = (4, b = 6"
PASS Invalid: "function f() { var a = (4, b = 6 }"
PASS Invalid: "const 'l' = 3"
PASS Invalid: "function f() { const 'l' = 3 }"
PASS Invalid: "var var = 3"
PASS Invalid: "function f() { var var = 3 }"
PASS Valid: "var varr = 3 in 1"
PASS Valid: "function f() { var varr = 3 in 1 }"
PASS Invalid: "const a, a, a = void 7 - typeof 8, a = 8"
PASS Invalid: "function f() { const a, a, a = void 7 - typeof 8, a = 8 }"
PASS Invalid: "const x_x = 6 /= 7 ? e : f"
PASS Invalid: "function f() { const x_x = 6 /= 7 ? e : f }"
PASS Invalid: "var a = ?"
PASS Invalid: "function f() { var a = ? }"
PASS Invalid: "const a = *7"
PASS Invalid: "function f() { const a = *7 }"
PASS Invalid: "var a = :)"
PASS Invalid: "function f() { var a = :) }"
PASS Valid: "var a = a in b in c instanceof d"
PASS Valid: "function f() { var a = a in b in c instanceof d }"
PASS Invalid: "var a = b ? c, b"
PASS Invalid: "function f() { var a = b ? c, b }"
PASS Invalid: "const a = b : c"
PASS Invalid: "function f() { const a = b : c }"
for statement
PASS Valid: "for ( ; ; ) { break }"
PASS Valid: "function f() { for ( ; ; ) { break } }"
PASS Valid: "for ( a ; ; ) { break }"
PASS Valid: "function f() { for ( a ; ; ) { break } }"
PASS Valid: "for ( ; a ; ) { break }"
PASS Valid: "function f() { for ( ; a ; ) { break } }"
PASS Valid: "for ( ; ; a ) { break }"
PASS Valid: "function f() { for ( ; ; a ) { break } }"
PASS Valid: "for ( a ; a ; ) break"
PASS Valid: "function f() { for ( a ; a ; ) break }"
PASS Valid: "for ( a ; ; a ) break"
PASS Valid: "function f() { for ( a ; ; a ) break }"
PASS Valid: "for ( ; a ; a ) break"
PASS Valid: "function f() { for ( ; a ; a ) break }"
PASS Invalid: "for () { }"
PASS Invalid: "function f() { for () { } }"
PASS Invalid: "for ( a ) { }"
PASS Invalid: "function f() { for ( a ) { } }"
PASS Invalid: "for ( ; ) ;"
PASS Invalid: "function f() { for ( ; ) ; }"
PASS Invalid: "for a ; b ; c { }"
PASS Invalid: "function f() { for a ; b ; c { } }"
PASS Invalid: "for (a ; { }"
PASS Invalid: "function f() { for (a ; { } }"
PASS Invalid: "for ( a ; ) ;"
PASS Invalid: "function f() { for ( a ; ) ; }"
PASS Invalid: "for ( ; a ) break"
PASS Invalid: "function f() { for ( ; a ) break }"
PASS Valid: "for (var a, b ; ; ) { break } "
PASS Valid: "function f() { for (var a, b ; ; ) { break } }"
PASS Valid: "for (var a = b, b = a ; ; ) break"
PASS Valid: "function f() { for (var a = b, b = a ; ; ) break }"
PASS Valid: "for (var a = b, c, d, b = a ; x in b ; ) { break }"
PASS Valid: "function f() { for (var a = b, c, d, b = a ; x in b ; ) { break } }"
PASS Valid: "for (var a = b, c, d ; ; 1 in a()) break"
PASS Valid: "function f() { for (var a = b, c, d ; ; 1 in a()) break }"
PASS Invalid: "for ( ; var a ; ) break"
PASS Invalid: "function f() { for ( ; var a ; ) break }"
PASS Invalid: "for (const a; ; ) break"
PASS Invalid: "function f() { for (const a; ; ) break }"
PASS Invalid: "for ( %a ; ; ) { }"
PASS Invalid: "function f() { for ( %a ; ; ) { } }"
PASS Valid: "for (a in b) break"
PASS Valid: "function f() { for (a in b) break }"
PASS Valid: "for (a() in b) break"
PASS Valid: "function f() { for (a() in b) break }"
PASS Valid: "for (a().l[4] in b) break"
PASS Valid: "function f() { for (a().l[4] in b) break }"
PASS Invalid: "for (new a in b in c in d) break"
PASS Invalid: "function f() { for (new a in b in c in d) break }"
PASS Invalid: "for (new new new a in b) break"
PASS Invalid: "function f() { for (new new new a in b) break }"
PASS Invalid: "for (delete new a() in b) break"
PASS Invalid: "function f() { for (delete new a() in b) break }"
PASS Invalid: "for (a * a in b) break"
PASS Invalid: "function f() { for (a * a in b) break }"
PASS Invalid: "for ((a * a) in b) break"
PASS Invalid: "function f() { for ((a * a) in b) break }"
PASS Invalid: "for (a++ in b) break"
PASS Invalid: "function f() { for (a++ in b) break }"
PASS Invalid: "for ((a++) in b) break"
PASS Invalid: "function f() { for ((a++) in b) break }"
PASS Invalid: "for (++a in b) break"
PASS Invalid: "function f() { for (++a in b) break }"
PASS Invalid: "for ((++a) in b) break"
PASS Invalid: "function f() { for ((++a) in b) break }"
PASS Invalid: "for (a, b in c) break"
PASS Invalid: "function f() { for (a, b in c) break }"
PASS Invalid: "for (a,b in c ;;) break"
PASS Invalid: "function f() { for (a,b in c ;;) break }"
PASS Valid: "for (a,(b in c) ;;) break"
PASS Valid: "function f() { for (a,(b in c) ;;) break }"
PASS Invalid: "for ((a, b) in c) break"
PASS Invalid: "function f() { for ((a, b) in c) break }"
PASS Invalid: "for (a ? b : c in c) break"
PASS Invalid: "function f() { for (a ? b : c in c) break }"
PASS Invalid: "for ((a ? b : c) in c) break"
PASS Invalid: "function f() { for ((a ? b : c) in c) break }"
PASS Valid: "for (var a in b in c) break"
PASS Valid: "function f() { for (var a in b in c) break }"
PASS Invalid: "for (var a = 5 += 6 in b) break"
PASS Invalid: "function f() { for (var a = 5 += 6 in b) break }"
PASS Invalid: "for (var a += 5 in b) break"
PASS Invalid: "function f() { for (var a += 5 in b) break }"
PASS Invalid: "for (var a = in b) break"
PASS Invalid: "function f() { for (var a = in b) break }"
PASS Invalid: "for (var a, b in b) break"
PASS Invalid: "function f() { for (var a, b in b) break }"
PASS Invalid: "for (var a = -6, b in b) break"
PASS Invalid: "function f() { for (var a = -6, b in b) break }"
PASS Invalid: "for (var a, b = 8 in b) break"
PASS Invalid: "function f() { for (var a, b = 8 in b) break }"
PASS Valid: "for (var a = (b in c) in d) break"
PASS Valid: "function f() { for (var a = (b in c) in d) break }"
PASS Invalid: "for (var a = (b in c in d) break"
PASS Invalid: "function f() { for (var a = (b in c in d) break }"
PASS Invalid: "for (var (a) in b) { }"
PASS Invalid: "function f() { for (var (a) in b) { } }"
PASS Invalid: "for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}"
PASS Invalid: "function f() { for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {} }"
try statement
PASS Valid: "try {} finally { c++ }"
PASS Valid: "function f() { try {} finally { c++ } }"
PASS Valid: "try { with (x) { } } catch(e) {} finally { if (a) ; }"
PASS Valid: "function f() { try { with (x) { } } catch(e) {} finally { if (a) ; } }"
PASS Invalid: "try {}"
PASS Invalid: "function f() { try {} }"
PASS Invalid: "catch(e) {}"
PASS Invalid: "function f() { catch(e) {} }"
PASS Invalid: "finally {}"
PASS Invalid: "function f() { finally {} }"
PASS Invalid: "try a; catch(e) {}"
PASS Invalid: "function f() { try a; catch(e) {} }"
PASS Invalid: "try {} catch(e) a()"
PASS Invalid: "function f() { try {} catch(e) a() }"
PASS Invalid: "try {} finally a()"
PASS Invalid: "function f() { try {} finally a() }"
PASS Invalid: "try {} catch(e)"
PASS Invalid: "function f() { try {} catch(e) }"
PASS Invalid: "try {} finally"
PASS Invalid: "function f() { try {} finally }"
PASS Invalid: "try {} finally {} catch(e) {}"
PASS Invalid: "function f() { try {} finally {} catch(e) {} }"
PASS Invalid: "try {} catch (...) {}"
PASS Invalid: "function f() { try {} catch (...) {} }"
PASS Valid: "try {} catch {}"
PASS Valid: "function f() { try {} catch {} }"
PASS Valid: "if (a) try {} finally {} else b;"
PASS Valid: "function f() { if (a) try {} finally {} else b; }"
PASS Valid: "if (--a()) do with(1) try {} catch(ke) { f() ; g() } while (a in b) else {}"
PASS Valid: "function f() { if (--a()) do with(1) try {} catch(ke) { f() ; g() } while (a in b) else {} }"
PASS Invalid: "if (a) try {} else b; catch (e) { }"
PASS Invalid: "function f() { if (a) try {} else b; catch (e) { } }"
PASS Invalid: "try { finally {}"
PASS Invalid: "function f() { try { finally {} }"
switch statement
PASS Valid: "switch (a) {}"
PASS Valid: "function f() { switch (a) {} }"
PASS Invalid: "switch () {}"
PASS Invalid: "function f() { switch () {} }"
PASS Invalid: "case 5:"
PASS Invalid: "function f() { case 5: }"
PASS Invalid: "default:"
PASS Invalid: "function f() { default: }"
PASS Invalid: "switch (a) b;"
PASS Invalid: "function f() { switch (a) b; }"
PASS Invalid: "switch (a) case 3: b;"
PASS Invalid: "function f() { switch (a) case 3: b; }"
PASS Valid: "switch (f()) { case 5 * f(): default: case '6' - 9: ++i }"
PASS Valid: "function f() { switch (f()) { case 5 * f(): default: case '6' - 9: ++i } }"
PASS Invalid: "switch (true) { default: case 6: default: }"
PASS Invalid: "function f() { switch (true) { default: case 6: default: } }"
PASS Invalid: "switch (l) { f(); }"
PASS Invalid: "function f() { switch (l) { f(); } }"
PASS Invalid: "switch (l) { case 1: ; a: case 5: }"
PASS Invalid: "function f() { switch (l) { case 1: ; a: case 5: } }"
PASS Valid: "switch (g() - h[5].l) { case 1 + 6: a: b: c: ++f }"
PASS Valid: "function f() { switch (g() - h[5].l) { case 1 + 6: a: b: c: ++f } }"
PASS Invalid: "switch (g) { case 1: a: }"
PASS Invalid: "function f() { switch (g) { case 1: a: } }"
PASS Invalid: "switch (g) { case 1: a: default: }"
PASS Invalid: "function f() { switch (g) { case 1: a: default: } }"
PASS Invalid: "switch g { case 1: l() }"
PASS Invalid: "function f() { switch g { case 1: l() } }"
PASS Invalid: "switch (g) { case 1:"
PASS Invalid: "function f() { switch (g) { case 1: }"
PASS Valid: "switch (l) { case a = b ? c : d : }"
PASS Valid: "function f() { switch (l) { case a = b ? c : d : } }"
PASS Valid: "switch (sw) { case a ? b - 7[1] ? [c,,] : d = 6 : { } : }"
PASS Valid: "function f() { switch (sw) { case a ? b - 7[1] ? [c,,] : d = 6 : { } : } }"
PASS Invalid: "switch (l) { case b ? c : }"
PASS Invalid: "function f() { switch (l) { case b ? c : } }"
PASS Valid: "switch (l) { case 1: a: with(g) switch (g) { case 2: default: } default: }"
PASS Valid: "function f() { switch (l) { case 1: a: with(g) switch (g) { case 2: default: } default: } }"
PASS Invalid: "switch (4 - ) { }"
PASS Invalid: "function f() { switch (4 - ) { } }"
PASS Invalid: "switch (l) { default case: 5; }"
PASS Invalid: "function f() { switch (l) { default case: 5; } }"
PASS Invalid: "for(var a,b 'this shouldn't be allowed' false ; ) ;"
PASS Invalid: "function f() { for(var a,b 'this shouldn't be allowed' false ; ) ; }"
PASS Invalid: "for(var a,b '"
PASS Invalid: "function f() { for(var a,b ' }"
PASS Valid: "function __proto__(){}"
PASS Valid: "function f() { function __proto__(){} }"
PASS Valid: "(function __proto__(){})"
PASS Valid: "function f() { (function __proto__(){}) }"
PASS Valid: "'use strict'; function __proto__(){}"
PASS Valid: "function f() { 'use strict'; function __proto__(){} }"
PASS Valid: "'use strict'; (function __proto__(){})"
PASS Valid: "function f() { 'use strict'; (function __proto__(){}) }"
PASS Valid: "if (0) $foo; "
PASS Valid: "function f() { if (0) $foo; }"
PASS Valid: "if (0) _foo; "
PASS Valid: "function f() { if (0) _foo; }"
PASS Valid: "if (0) foo$; "
PASS Valid: "function f() { if (0) foo$; }"
PASS Valid: "if (0) foo_; "
PASS Valid: "function f() { if (0) foo_; }"
PASS Valid: "if (0) obj.$foo; "
PASS Valid: "function f() { if (0) obj.$foo; }"
PASS Valid: "if (0) obj._foo; "
PASS Valid: "function f() { if (0) obj._foo; }"
PASS Valid: "if (0) obj.foo$; "
PASS Valid: "function f() { if (0) obj.foo$; }"
PASS Valid: "if (0) obj.foo_; "
PASS Valid: "function f() { if (0) obj.foo_; }"
PASS Valid: "if (0) obj.foo\u03bb; "
PASS Valid: "function f() { if (0) obj.foo\u03bb; }"
PASS Valid: "if (0) new a(b+c).d = 5"
PASS Valid: "function f() { if (0) new a(b+c).d = 5 }"
PASS Invalid: "if (0) new a(b+c) = 5"
PASS Invalid: "function f() { if (0) new a(b+c) = 5 }"
PASS Valid: "([1 || 1].a = 1)"
PASS Valid: "function f() { ([1 || 1].a = 1) }"
PASS Valid: "({a: 1 || 1}.a = 1)"
PASS Valid: "function f() { ({a: 1 || 1}.a = 1) }"
PASS Invalid: "var a.b = c"
PASS Invalid: "function f() { var a.b = c }"
PASS Invalid: "var a.b;"
PASS Invalid: "function f() { var a.b; }"
FAIL e.line should be 1 (of type number). Was undefined (of type undefined).
PASS foo is 'PASS'
PASS bar is 'PASS'
PASS successfullyParsed is true
TEST COMPLETE