Chromium Code Reviews| Index: test/mjsunit/harmony/block-scoping.js |
| diff --git a/test/mjsunit/harmony/block-scoping.js b/test/mjsunit/harmony/block-scoping.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6247914ad5f483d285e1688ff243dd1a6f1b9dbe |
| --- /dev/null |
| +++ b/test/mjsunit/harmony/block-scoping.js |
| @@ -0,0 +1,30 @@ |
| +// Flags: --allow-natives-syntax --harmony-block-scoping |
|
Kevin Millikin (Chromium)
2011/08/10 11:19:27
The test file needs a copyright notice.
Steven
2011/08/10 12:21:00
Done.
|
| + |
| +// Hoisting of var declarations. |
| +function f1() { |
| + { |
| + var x = 1; |
| + var y; |
| + } |
| + assertEquals(1, x) |
| + assertEquals(undefined, y) |
| +} |
| +f1(); |
| + |
| +// Dynamic lookup through block scopes. |
| +function f2(one) { |
| + var x = one + 1; |
| + // TODO(keuchel): introduce let |
| + // let y = one + 2; |
| + if (one == 1) { |
| + // Parameter |
| + assertEquals(1, eval('one')); |
| + // Function local var variable |
| + assertEquals(2, eval('x')); |
| + // Function local let variable |
| + // TODO(keuchel): introduce let |
| + // assertEquals(3, eval('y')); |
| + } |
| +} |
| +f2(); |
| + |