OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 function assertUndef(x) { | 6 function assertUndef(x) { |
7 assertEquals(undefined, x); | 7 assertEquals(undefined, x); |
8 } | 8 } |
9 | 9 |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 assertUndef(eval("var x = 1;")); | 139 assertUndef(eval("var x = 1;")); |
140 assertEquals(1, eval("if (true) { 1; } else { 2; }")); | 140 assertEquals(1, eval("if (true) { 1; } else { 2; }")); |
141 assertEquals(2, eval("if (false) { 1; } else { 2; }")); | 141 assertEquals(2, eval("if (false) { 1; } else { 2; }")); |
142 assertUndef(eval("try{1; if (true) { 2; throw ''; } else { 2; }} catch(e){}")); | 142 assertUndef(eval("try{1; if (true) { 2; throw ''; } else { 2; }} catch(e){}")); |
143 assertEquals(2, eval("1; var i = 0; do { ++i; 2; } while(i!=1);")); | 143 assertEquals(2, eval("1; var i = 0; do { ++i; 2; } while(i!=1);")); |
144 assertUndef(eval( | 144 assertUndef(eval( |
145 "try{1; var i = 0; do { ++i; 2; throw ''; } while (i!=1);} catch(e){}")); | 145 "try{1; var i = 0; do { ++i; 2; throw ''; } while (i!=1);} catch(e){}")); |
146 assertUndef(eval("1; try{2; throwOnReturn();} catch(e){}")); | 146 assertUndef(eval("1; try{2; throwOnReturn();} catch(e){}")); |
147 assertUndef(eval("1; twoFunc();")); | 147 assertUndef(eval("1; twoFunc();")); |
148 assertEquals(2, eval("1; with ( { a: 0 } ) { 2; }")); | 148 assertEquals(2, eval("1; with ( { a: 0 } ) { 2; }")); |
| 149 |
| 150 assertUndef(eval('a: while(true) { do { 0 } while(false); switch(1) { case 0: 1;
case 1: break a; }; 0 }')); |
| 151 assertUndef(eval('a: while(true) { do { 0 } while(false); try {} finally { break
a }; 0 }')); |
| 152 assertUndef(eval('a: while(true) { b: while(true) { 0; break b; }; switch(1) { c
ase 1: break a; }; 2 }')); |
| 153 assertUndef(eval('a: while(true) { b: while(true) { 0; break b; }; while (true)
{ break a; }; 2 }')); |
| 154 assertUndef(eval('while (true) { 20; a:{ break a; } with ({}) break; 30; }')); |
| 155 assertEquals(42, eval('a: while(true) { switch(0) { case 0: 42; case 1: break a;
}; 33 }')); |
OLD | NEW |