| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // 1. Redistributions of source code must retain the above copyright | 7 // 1. Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 9 // 2. Redistributions in binary form must reproduce the above copyright | 9 // 2. Redistributions in binary form must reproduce the above copyright |
| 10 // notice, this list of conditions and the following disclaimer in the | 10 // notice, this list of conditions and the following disclaimer in the |
| 11 // documentation and/or other materials provided with the distribution. | 11 // documentation and/or other materials provided with the distribution. |
| 12 // | 12 // |
| 13 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
| 14 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 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 AN
Y | 16 // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
| 17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 O
N | 19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
| 20 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | 23 |
| 24 // Flags: --no-harmony-restrictive-declarations | |
| 25 | |
| 26 description( | 24 description( |
| 27 "This test checks that the following expressions or statements are valid ECMASCR
IPT code or should throw parse error" | 25 "This test checks that the following expressions or statements are valid ECMASCR
IPT code or should throw parse error" |
| 28 ); | 26 ); |
| 29 | 27 |
| 30 function runTest(_a, errorType) | 28 function runTest(_a, errorType) |
| 31 { | 29 { |
| 32 var success; | 30 var success; |
| 33 if (typeof _a != "string") | 31 if (typeof _a != "string") |
| 34 testFailed("runTest expects string argument: " + _a); | 32 testFailed("runTest expects string argument: " + _a); |
| 35 try { | 33 try { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 invalid("break ; break your_limits ; continue ; continue living ; debugger"); | 222 invalid("break ; break your_limits ; continue ; continue living ; debugger"); |
| 225 invalid("debugger X"); | 223 invalid("debugger X"); |
| 226 invalid("break 0.2"); | 224 invalid("break 0.2"); |
| 227 invalid("continue a++"); | 225 invalid("continue a++"); |
| 228 invalid("continue (my_friend)"); | 226 invalid("continue (my_friend)"); |
| 229 valid ("while (1) break"); | 227 valid ("while (1) break"); |
| 230 valid ("do if (a) with (b) continue; else debugger; while (false)"); | 228 valid ("do if (a) with (b) continue; else debugger; while (false)"); |
| 231 invalid("do if (a) while (false) else debugger"); | 229 invalid("do if (a) while (false) else debugger"); |
| 232 invalid("while if (a) ;"); | 230 invalid("while if (a) ;"); |
| 233 valid ("if (a) function f() {} else function g() {}"); | 231 valid ("if (a) function f() {} else function g() {}"); |
| 234 valid ("if (a()) while(0) function f() {} else function g() {}"); | 232 invalid("if (a()) while(0) function f() {} else function g() {}"); |
| 235 invalid("if (a()) function f() { else function g() }"); | 233 invalid("if (a()) function f() { else function g() }"); |
| 236 invalid("if (a) if (b) ; else function f {}"); | 234 invalid("if (a) if (b) ; else function f {}"); |
| 237 invalid("if (a) if (b) ; else function (){}"); | 235 invalid("if (a) if (b) ; else function (){}"); |
| 238 valid ("throw a"); | 236 valid ("throw a"); |
| 239 valid ("throw a + b in void c"); | 237 valid ("throw a + b in void c"); |
| 240 invalid("throw"); | 238 invalid("throw"); |
| 241 | 239 |
| 242 debug ("var and const statements"); | 240 debug ("var and const statements"); |
| 243 | 241 |
| 244 valid ("var a, b = null"); | 242 valid ("var a, b = null"); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 394 |
| 397 try { eval("a.b.c = {};"); } catch(e1) { e=e1; shouldBe("e.line", "1") } | 395 try { eval("a.b.c = {};"); } catch(e1) { e=e1; shouldBe("e.line", "1") } |
| 398 foo = 'FAIL'; | 396 foo = 'FAIL'; |
| 399 bar = 'PASS'; | 397 bar = 'PASS'; |
| 400 try { | 398 try { |
| 401 eval("foo = 'PASS'; a.b.c = {}; bar = 'FAIL';"); | 399 eval("foo = 'PASS'; a.b.c = {}; bar = 'FAIL';"); |
| 402 } catch(e) { | 400 } catch(e) { |
| 403 shouldBe("foo", "'PASS'"); | 401 shouldBe("foo", "'PASS'"); |
| 404 shouldBe("bar", "'PASS'"); | 402 shouldBe("bar", "'PASS'"); |
| 405 } | 403 } |
| OLD | NEW |