Home | History | Annotate | Download | only in js
      1 # Copyright 2013 the V8 project authors. All rights reserved.
      2 # Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
      3 #
      4 # Redistribution and use in source and binary forms, with or without
      5 # modification, are permitted provided that the following conditions
      6 # are met:
      7 # 1.  Redistributions of source code must retain the above copyright
      8 #     notice, this list of conditions and the following disclaimer.
      9 # 2.  Redistributions in binary form must reproduce the above copyright
     10 #     notice, this list of conditions and the following disclaimer in the
     11 #     documentation and/or other materials provided with the distribution.
     12 #
     13 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
     14 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     15 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     16 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     17 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     18 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     19 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
     20 # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     21 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     22 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     23 
     24 This test checks that the following expressions or statements are valid ECMASCRIPT code or should throw parse error
     25 
     26 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     27 
     28 
     29 Unary operators and member access
     30 PASS Valid:   ""
     31 PASS Valid:   "function f() {  }"
     32 PASS Invalid: "(a"
     33 PASS Invalid: "function f() { (a }"
     34 PASS Invalid: "a[5"
     35 PASS Invalid: "function f() { a[5 }"
     36 PASS Invalid: "a[5 + 6"
     37 PASS Invalid: "function f() { a[5 + 6 }"
     38 PASS Invalid: "a."
     39 PASS Invalid: "function f() { a. }"
     40 PASS Invalid: "()"
     41 PASS Invalid: "function f() { () }"
     42 PASS Invalid: "a.'l'"
     43 PASS Invalid: "function f() { a.'l' }"
     44 PASS Valid:   "a: +~!new a"
     45 PASS Valid:   "function f() { a: +~!new a }"
     46 PASS Invalid: "new -a"
     47 PASS Invalid: "function f() { new -a }"
     48 PASS Valid:   "new (-1)"
     49 PASS Valid:   "function f() { new (-1) }"
     50 PASS Valid:   "a: b: c: new f(x++)++"
     51 PASS Valid:   "function f() { a: b: c: new f(x++)++ }"
     52 PASS Valid:   "(a)++"
     53 PASS Valid:   "function f() { (a)++ }"
     54 PASS Valid:   "(1--).x"
     55 PASS Valid:   "function f() { (1--).x }"
     56 PASS Invalid: "a-- ++"
     57 PASS Invalid: "function f() { a-- ++ }"
     58 PASS Invalid: "(a:) --b"
     59 PASS Invalid: "function f() { (a:) --b }"
     60 PASS Valid:   "++ -- ++ a"
     61 PASS Valid:   "function f() { ++ -- ++ a }"
     62 PASS Valid:   "++ new new a ++"
     63 PASS Valid:   "function f() { ++ new new a ++ }"
     64 PASS Valid:   "delete void 0"
     65 PASS Valid:   "function f() { delete void 0 }"
     66 PASS Invalid: "delete the void"
     67 PASS Invalid: "function f() { delete the void }"
     68 PASS Invalid: "(a++"
     69 PASS Invalid: "function f() { (a++ }"
     70 PASS Valid:   "++a--"
     71 PASS Valid:   "function f() { ++a-- }"
     72 PASS Valid:   "++((a))--"
     73 PASS Valid:   "function f() { ++((a))-- }"
     74 PASS Valid:   "(a.x++)++"
     75 PASS Valid:   "function f() { (a.x++)++ }"
     76 PASS Invalid: "1: null"
     77 PASS Invalid: "function f() { 1: null }"
     78 PASS Invalid: "+-!~"
     79 PASS Invalid: "function f() { +-!~ }"
     80 PASS Invalid: "+-!~(("
     81 PASS Invalid: "function f() { +-!~(( }"
     82 PASS Invalid: "a)"
     83 PASS Invalid: "function f() { a) }"
     84 PASS Invalid: "a]"
     85 PASS Invalid: "function f() { a] }"
     86 PASS Invalid: ".l"
     87 PASS Invalid: "function f() { .l }"
     88 PASS Invalid: "1.l"
     89 PASS Invalid: "function f() { 1.l }"
     90 PASS Valid:   "1 .l"
     91 PASS Valid:   "function f() { 1 .l }"
     92 Binary and conditional operators
     93 PASS Valid:   "a + + typeof this"
     94 PASS Valid:   "function f() { a + + typeof this }"
     95 PASS Invalid: "a + * b"
     96 PASS Invalid: "function f() { a + * b }"
     97 PASS Invalid: "a ? b"
     98 PASS Invalid: "function f() { a ? b }"
     99 PASS Invalid: "a ? b :"
    100 PASS Invalid: "function f() { a ? b : }"
    101 PASS Invalid: "%a"
    102 PASS Invalid: "function f() { %a }"
    103 PASS Invalid: "a-"
    104 PASS Invalid: "function f() { a- }"
    105 PASS Valid:   "a = b ? b = c : d = e"
    106 PASS Valid:   "function f() { a = b ? b = c : d = e }"
    107 PASS Valid:   "s: a[1].l ? b.l['s'] ? c++ : d : true"
    108 PASS Valid:   "function f() { s: a[1].l ? b.l['s'] ? c++ : d : true }"
    109 PASS Valid:   "a ? b + 1 ? c + 3 * d.l : d[5][6] : e"
    110 PASS Valid:   "function f() { a ? b + 1 ? c + 3 * d.l : d[5][6] : e }"
    111 PASS Valid:   "a in b instanceof delete -c"
    112 PASS Valid:   "function f() { a in b instanceof delete -c }"
    113 PASS Invalid: "a in instanceof b.l"
    114 PASS Invalid: "function f() { a in instanceof b.l }"
    115 PASS Valid:   "- - true % 5"
    116 PASS Valid:   "function f() { - - true % 5 }"
    117 FAIL Invalid: "- false = 3" should throw undefined
    118 FAIL Invalid: "function f() { - false = 3 }" should throw undefined
    119 PASS Valid:   "a: b: c: (1 + null) = 3"
    120 PASS Valid:   "function f() { a: b: c: (1 + null) = 3 }"
    121 PASS Valid:   "a[2] = b.l += c /= 4 * 7 ^ !6"
    122 PASS Valid:   "function f() { a[2] = b.l += c /= 4 * 7 ^ !6 }"
    123 FAIL Invalid: "a + typeof b += c in d" should throw undefined
    124 FAIL Invalid: "function f() { a + typeof b += c in d }" should throw undefined
    125 FAIL Invalid: "typeof a &= typeof b" should throw undefined
    126 FAIL Invalid: "function f() { typeof a &= typeof b }" should throw undefined
    127 PASS Valid:   "a: ((typeof (a))) >>>= a || b.l && c"
    128 PASS Valid:   "function f() { a: ((typeof (a))) >>>= a || b.l && c }"
    129 PASS Valid:   "a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g"
    130 PASS Valid:   "function f() { a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g }"
    131 PASS Valid:   "-void+x['y'].l == x.l != 5 - f[7]"
    132 PASS Valid:   "function f() { -void+x['y'].l == x.l != 5 - f[7] }"
    133 Function calls (and new with arguments)
    134 PASS Valid:   "a()()()"
    135 PASS Valid:   "function f() { a()()() }"
    136 PASS Valid:   "s: l: a[2](4 == 6, 5 = 6)(f[4], 6)"
    137 PASS Valid:   "function f() { s: l: a[2](4 == 6, 5 = 6)(f[4], 6) }"
    138 PASS Valid:   "s: eval(a.apply(), b.call(c[5] - f[7]))"
    139 PASS Valid:   "function f() { s: eval(a.apply(), b.call(c[5] - f[7])) }"
    140 PASS Invalid: "a("
    141 PASS Invalid: "function f() { a( }"
    142 PASS Invalid: "a(5"
    143 PASS Invalid: "function f() { a(5 }"
    144 PASS Invalid: "a(5,"
    145 PASS Invalid: "function f() { a(5, }"
    146 PASS Invalid: "a(5,)"
    147 PASS Invalid: "function f() { a(5,) }"
    148 PASS Invalid: "a(5,6"
    149 PASS Invalid: "function f() { a(5,6 }"
    150 PASS Valid:   "a(b[7], c <d> e.l, new a() > b)"
    151 PASS Valid:   "function f() { a(b[7], c <d> e.l, new a() > b) }"
    152 PASS Invalid: "a(b[5)"
    153 PASS Invalid: "function f() { a(b[5) }"
    154 PASS Invalid: "a(b.)"
    155 PASS Invalid: "function f() { a(b.) }"
    156 PASS Valid:   "~new new a(1)(i++)(c[l])"
    157 PASS Valid:   "function f() { ~new new a(1)(i++)(c[l]) }"
    158 PASS Invalid: "a(*a)"
    159 PASS Invalid: "function f() { a(*a) }"
    160 PASS Valid:   "((((a))((b)()).l))()"
    161 PASS Valid:   "function f() { ((((a))((b)()).l))() }"
    162 PASS Valid:   "(a)[b + (c) / (d())].l--"
    163 PASS Valid:   "function f() { (a)[b + (c) / (d())].l-- }"
    164 PASS Valid:   "new (5)"
    165 PASS Valid:   "function f() { new (5) }"
    166 PASS Invalid: "new a(5"
    167 PASS Invalid: "function f() { new a(5 }"
    168 PASS Valid:   "new (f + 5)(6, (g)() - 'l'() - true(false))"
    169 PASS Valid:   "function f() { new (f + 5)(6, (g)() - 'l'() - true(false)) }"
    170 PASS Invalid: "a(.length)"
    171 PASS Invalid: "function f() { a(.length) }"
    172 function declaration and expression
    173 PASS Valid:   "function f() {}"
    174 PASS Valid:   "function f() { function f() {} }"
    175 PASS Valid:   "function f(a,b) {}"
    176 PASS Valid:   "function f() { function f(a,b) {} }"
    177 PASS Invalid: "function () {}"
    178 PASS Invalid: "function f() { function () {} }"
    179 PASS Invalid: "function f(a b) {}"
    180 PASS Invalid: "function f() { function f(a b) {} }"
    181 PASS Invalid: "function f(a,) {}"
    182 PASS Invalid: "function f() { function f(a,) {} }"
    183 PASS Invalid: "function f(a,"
    184 PASS Invalid: "function f() { function f(a, }"
    185 PASS Invalid: "function f(a, 1) {}"
    186 PASS Invalid: "function f() { function f(a, 1) {} }"
    187 PASS Valid:   "function g(arguments, eval) {}"
    188 PASS Valid:   "function f() { function g(arguments, eval) {} }"
    189 PASS Valid:   "function f() {} + function g() {}"
    190 PASS Valid:   "function f() { function f() {} + function g() {} }"
    191 PASS Invalid: "(function a{})"
    192 PASS Invalid: "function f() { (function a{}) }"
    193 PASS Invalid: "(function this(){})"
    194 PASS Invalid: "function f() { (function this(){}) }"
    195 PASS Valid:   "(delete new function f(){} + function(a,b){}(5)(6))"
    196 PASS Valid:   "function f() { (delete new function f(){} + function(a,b){}(5)(6)) }"
    197 PASS Valid:   "6 - function (m) { function g() {} }"
    198 PASS Valid:   "function f() { 6 - function (m) { function g() {} } }"
    199 PASS Invalid: "function l() {"
    200 PASS Invalid: "function f() { function l() { }"
    201 PASS Invalid: "function l++(){}"
    202 PASS Invalid: "function f() { function l++(){} }"
    203 Array and object literal, comma operator
    204 PASS Valid:   "[] in [5,6] * [,5,] / [,,5,,] || [a,] && new [,b] % [,,]"
    205 PASS Valid:   "function f() { [] in [5,6] * [,5,] / [,,5,,] || [a,] && new [,b] % [,,] }"
    206 PASS Invalid: "[5,"
    207 PASS Invalid: "function f() { [5, }"
    208 PASS Invalid: "[,"
    209 PASS Invalid: "function f() { [, }"
    210 PASS Invalid: "(a,)"
    211 PASS Invalid: "function f() { (a,) }"
    212 PASS Valid:   "1 + {get get(){}, set set(a){}, get1:4, set1:get-set, }"
    213 PASS Valid:   "function f() { 1 + {get get(){}, set set(a){}, get1:4, set1:get-set, } }"
    214 PASS Invalid: "1 + {a"
    215 PASS Invalid: "function f() { 1 + {a }"
    216 PASS Invalid: "1 + {a:"
    217 PASS Invalid: "function f() { 1 + {a: }"
    218 PASS Invalid: "1 + {get l("
    219 PASS Invalid: "function f() { 1 + {get l( }"
    220 PASS Invalid: ",a"
    221 PASS Invalid: "function f() { ,a }"
    222 PASS Valid:   "(4,(5,a(3,4))),f[4,a-6]"
    223 PASS Valid:   "function f() { (4,(5,a(3,4))),f[4,a-6] }"
    224 PASS Invalid: "(,f)"
    225 PASS Invalid: "function f() { (,f) }"
    226 PASS Invalid: "a,,b"
    227 PASS Invalid: "function f() { a,,b }"
    228 PASS Invalid: "a ? b, c : d"
    229 PASS Invalid: "function f() { a ? b, c : d }"
    230 simple statements
    231 PASS Valid:   "{ }"
    232 PASS Valid:   "function f() { { } }"
    233 PASS Invalid: "{ { }"
    234 PASS Invalid: "function f() { { { } }"
    235 PASS Valid:   "{ ; ; ; }"
    236 PASS Valid:   "function f() { { ; ; ; } }"
    237 PASS Valid:   "a: { ; }"
    238 PASS Valid:   "function f() { a: { ; } }"
    239 PASS Invalid: "{ a: }"
    240 PASS Invalid: "function f() { { a: } }"
    241 PASS Valid:   "{} f; { 6 + f() }"
    242 PASS Valid:   "function f() { {} f; { 6 + f() } }"
    243 PASS Valid:   "{ a[5],6; {} ++b-new (-5)() } c().l++"
    244 PASS Valid:   "function f() { { a[5],6; {} ++b-new (-5)() } c().l++ }"
    245 PASS Valid:   "{ l1: l2: l3: { this } a = 32 ; { i++ ; { { { } } ++i } } }"
    246 PASS Valid:   "function f() { { l1: l2: l3: { this } a = 32 ; { i++ ; { { { } } ++i } } } }"
    247 PASS Valid:   "if (a) ;"
    248 PASS Valid:   "function f() { if (a) ; }"
    249 PASS Invalid: "{ if (a) }"
    250 PASS Invalid: "function f() { { if (a) } }"
    251 PASS Invalid: "if a {}"
    252 PASS Invalid: "function f() { if a {} }"
    253 PASS Invalid: "if (a"
    254 PASS Invalid: "function f() { if (a }"
    255 PASS Invalid: "if (a { }"
    256 PASS Invalid: "function f() { if (a { } }"
    257 PASS Valid:   "x: s: if (a) ; else b"
    258 PASS Valid:   "function f() { x: s: if (a) ; else b }"
    259 PASS Invalid: "else {}"
    260 PASS Invalid: "function f() { else {} }"
    261 PASS Valid:   "if (a) if (b) y; else {} else ;"
    262 PASS Valid:   "function f() { if (a) if (b) y; else {} else ; }"
    263 PASS Invalid: "if (a) {} else x; else"
    264 PASS Invalid: "function f() { if (a) {} else x; else }"
    265 PASS Invalid: "if (a) { else }"
    266 PASS Invalid: "function f() { if (a) { else } }"
    267 PASS Valid:   "if (a.l + new b()) 4 + 5 - f()"
    268 PASS Valid:   "function f() { if (a.l + new b()) 4 + 5 - f() }"
    269 PASS Valid:   "if (a) with (x) ; else with (y) ;"
    270 PASS Valid:   "function f() { if (a) with (x) ; else with (y) ; }"
    271 PASS Invalid: "with a.b { }"
    272 PASS Invalid: "function f() { with a.b { } }"
    273 PASS Valid:   "while (a() - new b) ;"
    274 PASS Valid:   "function f() { while (a() - new b) ; }"
    275 PASS Invalid: "while a {}"
    276 PASS Invalid: "function f() { while a {} }"
    277 PASS Valid:   "do ; while(0) i++"
    278 PASS Valid:   "function f() { do ; while(0) i++ }"
    279 PASS Valid:   "do if (a) x; else y; while(z)"
    280 PASS Valid:   "function f() { do if (a) x; else y; while(z) }"
    281 PASS Invalid: "do g; while 4"
    282 PASS Invalid: "function f() { do g; while 4 }"
    283 PASS Invalid: "do g; while ((4)"
    284 PASS Invalid: "function f() { do g; while ((4) }"
    285 PASS Valid:   "{ { do do do ; while(0) while(0) while(0) } }"
    286 PASS Valid:   "function f() { { { do do do ; while(0) while(0) while(0) } } }"
    287 PASS Valid:   "do while (0) if (a) {} else y; while(0)"
    288 PASS Valid:   "function f() { do while (0) if (a) {} else y; while(0) }"
    289 PASS Valid:   "if (a) while (b) if (c) with(d) {} else e; else f"
    290 PASS Valid:   "function f() { if (a) while (b) if (c) with(d) {} else e; else f }"
    291 PASS Invalid: "break ; break your_limits ; continue ; continue living ; debugger"
    292 PASS Invalid: "function f() { break ; break your_limits ; continue ; continue living ; debugger }"
    293 PASS Invalid: "debugger X"
    294 PASS Invalid: "function f() { debugger X }"
    295 PASS Invalid: "break 0.2"
    296 PASS Invalid: "function f() { break 0.2 }"
    297 PASS Invalid: "continue a++"
    298 PASS Invalid: "function f() { continue a++ }"
    299 PASS Invalid: "continue (my_friend)"
    300 PASS Invalid: "function f() { continue (my_friend) }"
    301 PASS Valid:   "while (1) break"
    302 PASS Valid:   "function f() { while (1) break }"
    303 PASS Valid:   "do if (a) with (b) continue; else debugger; while (false)"
    304 PASS Valid:   "function f() { do if (a) with (b) continue; else debugger; while (false) }"
    305 PASS Invalid: "do if (a) while (false) else debugger"
    306 PASS Invalid: "function f() { do if (a) while (false) else debugger }"
    307 PASS Invalid: "while if (a) ;"
    308 PASS Invalid: "function f() { while if (a) ; }"
    309 PASS Valid:   "if (a) function f() {} else function g() {}"
    310 PASS Valid:   "function f() { if (a) function f() {} else function g() {} }"
    311 PASS Valid:   "if (a()) while(0) function f() {} else function g() {}"
    312 PASS Valid:   "function f() { if (a()) while(0) function f() {} else function g() {} }"
    313 PASS Invalid: "if (a()) function f() { else function g() }"
    314 PASS Invalid: "function f() { if (a()) function f() { else function g() } }"
    315 PASS Invalid: "if (a) if (b) ; else function f {}"
    316 PASS Invalid: "function f() { if (a) if (b) ; else function f {} }"
    317 PASS Invalid: "if (a) if (b) ; else function (){}"
    318 PASS Invalid: "function f() { if (a) if (b) ; else function (){} }"
    319 PASS Valid:   "throw a"
    320 PASS Valid:   "function f() { throw a }"
    321 PASS Valid:   "throw a + b in void c"
    322 PASS Valid:   "function f() { throw a + b in void c }"
    323 PASS Invalid: "throw"
    324 PASS Invalid: "function f() { throw }"
    325 var and const statements
    326 PASS Valid:   "var a, b = null"
    327 PASS Valid:   "function f() { var a, b = null }"
    328 PASS Valid:   "const a = 5, b, c"
    329 PASS Valid:   "function f() { const a = 5, b, c }"
    330 PASS Invalid: "var"
    331 PASS Invalid: "function f() { var }"
    332 PASS Invalid: "var = 7"
    333 PASS Invalid: "function f() { var = 7 }"
    334 PASS Invalid: "var c (6)"
    335 PASS Invalid: "function f() { var c (6) }"
    336 PASS Valid:   "if (a) var a,b; else const b, c"
    337 PASS Valid:   "function f() { if (a) var a,b; else const b, c }"
    338 PASS Invalid: "var 5 = 6"
    339 PASS Invalid: "function f() { var 5 = 6 }"
    340 PASS Valid:   "while (0) var a, b, c=6, d, e, f=5*6, g=f*h, h"
    341 PASS Valid:   "function f() { while (0) var a, b, c=6, d, e, f=5*6, g=f*h, h }"
    342 PASS Invalid: "var a = if (b) { c }"
    343 PASS Invalid: "function f() { var a = if (b) { c } }"
    344 PASS Invalid: "var a = var b"
    345 PASS Invalid: "function f() { var a = var b }"
    346 PASS Valid:   "const a = b += c, a, a, a = (b - f())"
    347 PASS Valid:   "function f() { const a = b += c, a, a, a = (b - f()) }"
    348 PASS Invalid: "var a %= b | 5"
    349 PASS Invalid: "function f() { var a %= b | 5 }"
    350 PASS Invalid: "var (a) = 5"
    351 PASS Invalid: "function f() { var (a) = 5 }"
    352 PASS Invalid: "var a = (4, b = 6"
    353 PASS Invalid: "function f() { var a = (4, b = 6 }"
    354 PASS Invalid: "const 'l' = 3"
    355 PASS Invalid: "function f() { const 'l' = 3 }"
    356 PASS Invalid: "var var = 3"
    357 PASS Invalid: "function f() { var var = 3 }"
    358 PASS Valid:   "var varr = 3 in 1"
    359 PASS Valid:   "function f() { var varr = 3 in 1 }"
    360 PASS Valid:   "const a, a, a = void 7 - typeof 8, a = 8"
    361 PASS Valid:   "function f() { const a, a, a = void 7 - typeof 8, a = 8 }"
    362 PASS Valid:   "const x_x = 6 /= 7 ? e : f"
    363 PASS Valid:   "function f() { const x_x = 6 /= 7 ? e : f }"
    364 PASS Invalid: "var a = ?"
    365 PASS Invalid: "function f() { var a = ? }"
    366 PASS Invalid: "const a = *7"
    367 PASS Invalid: "function f() { const a = *7 }"
    368 PASS Invalid: "var a = :)"
    369 PASS Invalid: "function f() { var a = :) }"
    370 PASS Valid:   "var a = a in b in c instanceof d"
    371 PASS Valid:   "function f() { var a = a in b in c instanceof d }"
    372 PASS Invalid: "var a = b ? c, b"
    373 PASS Invalid: "function f() { var a = b ? c, b }"
    374 PASS Invalid: "const a = b : c"
    375 PASS Invalid: "function f() { const a = b : c }"
    376 for statement
    377 PASS Valid:   "for ( ; ; ) { break }"
    378 PASS Valid:   "function f() { for ( ; ; ) { break } }"
    379 PASS Valid:   "for ( a ; ; ) { break }"
    380 PASS Valid:   "function f() { for ( a ; ; ) { break } }"
    381 PASS Valid:   "for ( ; a ; ) { break }"
    382 PASS Valid:   "function f() { for ( ; a ; ) { break } }"
    383 PASS Valid:   "for ( ; ; a ) { break }"
    384 PASS Valid:   "function f() { for ( ; ; a ) { break } }"
    385 PASS Valid:   "for ( a ; a ; ) break"
    386 PASS Valid:   "function f() { for ( a ; a ; ) break }"
    387 PASS Valid:   "for ( a ; ; a ) break"
    388 PASS Valid:   "function f() { for ( a ; ; a ) break }"
    389 PASS Valid:   "for ( ; a ; a ) break"
    390 PASS Valid:   "function f() { for ( ; a ; a ) break }"
    391 PASS Invalid: "for () { }"
    392 PASS Invalid: "function f() { for () { } }"
    393 PASS Invalid: "for ( a ) { }"
    394 PASS Invalid: "function f() { for ( a ) { } }"
    395 PASS Invalid: "for ( ; ) ;"
    396 PASS Invalid: "function f() { for ( ; ) ; }"
    397 PASS Invalid: "for a ; b ; c { }"
    398 PASS Invalid: "function f() { for a ; b ; c { } }"
    399 PASS Invalid: "for (a ; { }"
    400 PASS Invalid: "function f() { for (a ; { } }"
    401 PASS Invalid: "for ( a ; ) ;"
    402 PASS Invalid: "function f() { for ( a ; ) ; }"
    403 PASS Invalid: "for ( ; a ) break"
    404 PASS Invalid: "function f() { for ( ; a ) break }"
    405 PASS Valid:   "for (var a, b ; ; ) { break } "
    406 PASS Valid:   "function f() { for (var a, b ; ; ) { break }  }"
    407 PASS Valid:   "for (var a = b, b = a ; ; ) break"
    408 PASS Valid:   "function f() { for (var a = b, b = a ; ; ) break }"
    409 PASS Valid:   "for (var a = b, c, d, b = a ; x in b ; ) { break }"
    410 PASS Valid:   "function f() { for (var a = b, c, d, b = a ; x in b ; ) { break } }"
    411 PASS Valid:   "for (var a = b, c, d ; ; 1 in a()) break"
    412 PASS Valid:   "function f() { for (var a = b, c, d ; ; 1 in a()) break }"
    413 PASS Invalid: "for ( ; var a ; ) break"
    414 PASS Invalid: "function f() { for ( ; var a ; ) break }"
    415 FAIL Invalid: "for (const a; ; ) break" should throw undefined
    416 FAIL Invalid: "function f() { for (const a; ; ) break }" should throw undefined
    417 PASS Invalid: "for ( %a ; ; ) { }"
    418 PASS Invalid: "function f() { for ( %a ; ; ) { } }"
    419 PASS Valid:   "for (a in b) break"
    420 PASS Valid:   "function f() { for (a in b) break }"
    421 PASS Valid:   "for (a() in b) break"
    422 PASS Valid:   "function f() { for (a() in b) break }"
    423 PASS Valid:   "for (a().l[4] in b) break"
    424 PASS Valid:   "function f() { for (a().l[4] in b) break }"
    425 PASS Valid:   "for (new a in b in c in d) break"
    426 PASS Valid:   "function f() { for (new a in b in c in d) break }"
    427 PASS Valid:   "for (new new new a in b) break"
    428 PASS Valid:   "function f() { for (new new new a in b) break }"
    429 FAIL Invalid: "for (delete new a() in b) break" should throw undefined
    430 FAIL Invalid: "function f() { for (delete new a() in b) break }" should throw undefined
    431 FAIL Invalid: "for (a * a in b) break" should throw undefined
    432 FAIL Invalid: "function f() { for (a * a in b) break }" should throw undefined
    433 PASS Valid:   "for ((a * a) in b) break"
    434 PASS Valid:   "function f() { for ((a * a) in b) break }"
    435 FAIL Invalid: "for (a++ in b) break" should throw undefined
    436 FAIL Invalid: "function f() { for (a++ in b) break }" should throw undefined
    437 PASS Valid:   "for ((a++) in b) break"
    438 PASS Valid:   "function f() { for ((a++) in b) break }"
    439 FAIL Invalid: "for (++a in b) break" should throw undefined
    440 FAIL Invalid: "function f() { for (++a in b) break }" should throw undefined
    441 PASS Valid:   "for ((++a) in b) break"
    442 PASS Valid:   "function f() { for ((++a) in b) break }"
    443 FAIL Invalid: "for (a, b in c) break" should throw undefined
    444 FAIL Invalid: "function f() { for (a, b in c) break }" should throw undefined
    445 PASS Invalid: "for (a,b in c ;;) break"
    446 PASS Invalid: "function f() { for (a,b in c ;;) break }"
    447 PASS Valid:   "for (a,(b in c) ;;) break"
    448 PASS Valid:   "function f() { for (a,(b in c) ;;) break }"
    449 PASS Valid:   "for ((a, b) in c) break"
    450 PASS Valid:   "function f() { for ((a, b) in c) break }"
    451 FAIL Invalid: "for (a ? b : c in c) break" should throw undefined
    452 FAIL Invalid: "function f() { for (a ? b : c in c) break }" should throw undefined
    453 PASS Valid:   "for ((a ? b : c) in c) break"
    454 PASS Valid:   "function f() { for ((a ? b : c) in c) break }"
    455 PASS Valid:   "for (var a in b in c) break"
    456 PASS Valid:   "function f() { for (var a in b in c) break }"
    457 PASS Valid:   "for (var a = 5 += 6 in b) break"
    458 PASS Valid:   "function f() { for (var a = 5 += 6 in b) break }"
    459 PASS Invalid: "for (var a += 5 in b) break"
    460 PASS Invalid: "function f() { for (var a += 5 in b) break }"
    461 PASS Invalid: "for (var a = in b) break"
    462 PASS Invalid: "function f() { for (var a = in b) break }"
    463 PASS Invalid: "for (var a, b in b) break"
    464 PASS Invalid: "function f() { for (var a, b in b) break }"
    465 PASS Invalid: "for (var a = -6, b in b) break"
    466 PASS Invalid: "function f() { for (var a = -6, b in b) break }"
    467 PASS Invalid: "for (var a, b = 8 in b) break"
    468 PASS Invalid: "function f() { for (var a, b = 8 in b) break }"
    469 PASS Valid:   "for (var a = (b in c) in d) break"
    470 PASS Valid:   "function f() { for (var a = (b in c) in d) break }"
    471 PASS Invalid: "for (var a = (b in c in d) break"
    472 PASS Invalid: "function f() { for (var a = (b in c in d) break }"
    473 PASS Invalid: "for (var (a) in b) { }"
    474 PASS Invalid: "function f() { for (var (a) in b) { } }"
    475 PASS Valid:   "for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}"
    476 PASS Valid:   "function f() { for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {} }"
    477 try statement
    478 PASS Invalid: "try { break } catch(e) {}"
    479 PASS Invalid: "function f() { try { break } catch(e) {} }"
    480 PASS Valid:   "try {} finally { c++ }"
    481 PASS Valid:   "function f() { try {} finally { c++ } }"
    482 PASS Valid:   "try { with (x) { } } catch(e) {} finally { if (a) ; }"
    483 PASS Valid:   "function f() { try { with (x) { } } catch(e) {} finally { if (a) ; } }"
    484 PASS Invalid: "try {}"
    485 PASS Invalid: "function f() { try {} }"
    486 PASS Invalid: "catch(e) {}"
    487 PASS Invalid: "function f() { catch(e) {} }"
    488 PASS Invalid: "finally {}"
    489 PASS Invalid: "function f() { finally {} }"
    490 PASS Invalid: "try a; catch(e) {}"
    491 PASS Invalid: "function f() { try a; catch(e) {} }"
    492 PASS Invalid: "try {} catch(e) a()"
    493 PASS Invalid: "function f() { try {} catch(e) a() }"
    494 PASS Invalid: "try {} finally a()"
    495 PASS Invalid: "function f() { try {} finally a() }"
    496 PASS Invalid: "try {} catch(e)"
    497 PASS Invalid: "function f() { try {} catch(e) }"
    498 PASS Invalid: "try {} finally"
    499 PASS Invalid: "function f() { try {} finally }"
    500 PASS Invalid: "try {} finally {} catch(e) {}"
    501 PASS Invalid: "function f() { try {} finally {} catch(e) {} }"
    502 PASS Invalid: "try {} catch (...) {}"
    503 PASS Invalid: "function f() { try {} catch (...) {} }"
    504 PASS Invalid: "try {} catch {}"
    505 PASS Invalid: "function f() { try {} catch {} }"
    506 PASS Valid:   "if (a) try {} finally {} else b;"
    507 PASS Valid:   "function f() { if (a) try {} finally {} else b; }"
    508 PASS Valid:   "if (--a()) do with(1) try {} catch(ke) { f() ; g() } while (a in b) else {}"
    509 PASS Valid:   "function f() { if (--a()) do with(1) try {} catch(ke) { f() ; g() } while (a in b) else {} }"
    510 PASS Invalid: "if (a) try {} else b; catch (e) { }"
    511 PASS Invalid: "function f() { if (a) try {} else b; catch (e) { } }"
    512 PASS Invalid: "try { finally {}"
    513 PASS Invalid: "function f() { try { finally {} }"
    514 switch statement
    515 PASS Valid:   "switch (a) {}"
    516 PASS Valid:   "function f() { switch (a) {} }"
    517 PASS Invalid: "switch () {}"
    518 PASS Invalid: "function f() { switch () {} }"
    519 PASS Invalid: "case 5:"
    520 PASS Invalid: "function f() { case 5: }"
    521 PASS Invalid: "default:"
    522 PASS Invalid: "function f() { default: }"
    523 PASS Invalid: "switch (a) b;"
    524 PASS Invalid: "function f() { switch (a) b; }"
    525 PASS Invalid: "switch (a) case 3: b;"
    526 PASS Invalid: "function f() { switch (a) case 3: b; }"
    527 PASS Valid:   "switch (f()) { case 5 * f(): default: case '6' - 9: ++i }"
    528 PASS Valid:   "function f() { switch (f()) { case 5 * f(): default: case '6' - 9: ++i } }"
    529 PASS Invalid: "switch (true) { default: case 6: default: }"
    530 PASS Invalid: "function f() { switch (true) { default: case 6: default: } }"
    531 PASS Invalid: "switch (l) { f(); }"
    532 PASS Invalid: "function f() { switch (l) { f(); } }"
    533 PASS Invalid: "switch (l) { case 1: ; a: case 5: }"
    534 PASS Invalid: "function f() { switch (l) { case 1: ; a: case 5: } }"
    535 PASS Valid:   "switch (g() - h[5].l) { case 1 + 6: a: b: c: ++f }"
    536 PASS Valid:   "function f() { switch (g() - h[5].l) { case 1 + 6: a: b: c: ++f } }"
    537 PASS Invalid: "switch (g) { case 1: a: }"
    538 PASS Invalid: "function f() { switch (g) { case 1: a: } }"
    539 PASS Invalid: "switch (g) { case 1: a: default: }"
    540 PASS Invalid: "function f() { switch (g) { case 1: a: default: } }"
    541 PASS Invalid: "switch g { case 1: l() }"
    542 PASS Invalid: "function f() { switch g { case 1: l() } }"
    543 PASS Invalid: "switch (g) { case 1:"
    544 PASS Invalid: "function f() { switch (g) { case 1: }"
    545 PASS Valid:   "switch (l) { case a = b ? c : d : }"
    546 PASS Valid:   "function f() { switch (l) { case a = b ? c : d : } }"
    547 PASS Valid:   "switch (sw) { case a ? b - 7[1] ? [c,,] : d = 6 : { } : }"
    548 PASS Valid:   "function f() { switch (sw) { case a ? b - 7[1] ? [c,,] : d = 6 : { } : } }"
    549 PASS Invalid: "switch (l) { case b ? c : }"
    550 PASS Invalid: "function f() { switch (l) { case b ? c : } }"
    551 PASS Valid:   "switch (l) { case 1: a: with(g) switch (g) { case 2: default: } default: }"
    552 PASS Valid:   "function f() { switch (l) { case 1: a: with(g) switch (g) { case 2: default: } default: } }"
    553 PASS Invalid: "switch (4 - ) { }"
    554 PASS Invalid: "function f() { switch (4 - ) { } }"
    555 PASS Invalid: "switch (l) { default case: 5; }"
    556 PASS Invalid: "function f() { switch (l) { default case: 5; } }"
    557 PASS Invalid: "L: L: ;"
    558 PASS Invalid: "function f() { L: L: ; }"
    559 PASS Invalid: "L: L1: L: ;"
    560 PASS Invalid: "function f() { L: L1: L: ; }"
    561 PASS Invalid: "L: L1: L2: L3: L4: L: ;"
    562 PASS Invalid: "function f() { L: L1: L2: L3: L4: L: ; }"
    563 PASS Invalid: "for(var a,b 'this shouldn't be allowed' false ; ) ;"
    564 PASS Invalid: "function f() { for(var a,b 'this shouldn't be allowed' false ; ) ; }"
    565 PASS Invalid: "for(var a,b '"
    566 PASS Invalid: "function f() { for(var a,b ' }"
    567 PASS Valid:   "function __proto__(){}"
    568 PASS Valid:   "function f() { function __proto__(){} }"
    569 PASS Valid:   "(function __proto__(){})"
    570 PASS Valid:   "function f() { (function __proto__(){}) }"
    571 PASS Valid:   "'use strict'; function __proto__(){}"
    572 PASS Valid:   "function f() { 'use strict'; function __proto__(){} }"
    573 PASS Valid:   "'use strict'; (function __proto__(){})"
    574 PASS Valid:   "function f() { 'use strict'; (function __proto__(){}) }"
    575 PASS Valid:   "if (0) $foo; "
    576 PASS Valid:   "function f() { if (0) $foo;  }"
    577 PASS Valid:   "if (0) _foo; "
    578 PASS Valid:   "function f() { if (0) _foo;  }"
    579 PASS Valid:   "if (0) foo$; "
    580 PASS Valid:   "function f() { if (0) foo$;  }"
    581 PASS Valid:   "if (0) foo_; "
    582 PASS Valid:   "function f() { if (0) foo_;  }"
    583 PASS Valid:   "if (0) obj.$foo; "
    584 PASS Valid:   "function f() { if (0) obj.$foo;  }"
    585 PASS Valid:   "if (0) obj._foo; "
    586 PASS Valid:   "function f() { if (0) obj._foo;  }"
    587 PASS Valid:   "if (0) obj.foo$; "
    588 PASS Valid:   "function f() { if (0) obj.foo$;  }"
    589 PASS Valid:   "if (0) obj.foo_; "
    590 PASS Valid:   "function f() { if (0) obj.foo_;  }"
    591 PASS Valid:   "if (0) obj.foo\u03bb; "
    592 PASS Valid:   "function f() { if (0) obj.foo\u03bb;  }"
    593 PASS Valid:   "if (0) new a(b+c).d = 5"
    594 PASS Valid:   "function f() { if (0) new a(b+c).d = 5 }"
    595 PASS Valid:   "if (0) new a(b+c) = 5"
    596 PASS Valid:   "function f() { if (0) new a(b+c) = 5 }"
    597 PASS Valid:   "([1 || 1].a = 1)"
    598 PASS Valid:   "function f() { ([1 || 1].a = 1) }"
    599 PASS Valid:   "({a: 1 || 1}.a = 1)"
    600 PASS Valid:   "function f() { ({a: 1 || 1}.a = 1) }"
    601 PASS Invalid: "var a.b = c"
    602 PASS Invalid: "function f() { var a.b = c }"
    603 PASS Invalid: "var a.b;"
    604 PASS Invalid: "function f() { var a.b; }"
    605 FAIL e.line should be 1 (of type number). Was undefined (of type undefined).
    606 PASS foo is 'PASS'
    607 PASS bar is 'PASS'
    608 PASS successfullyParsed is true
    609 
    610 TEST COMPLETE
    611 
    612