Chromium Code Reviews| Index: test/mjsunit/harmony/destructuring.js |
| diff --git a/test/mjsunit/harmony/destructuring.js b/test/mjsunit/harmony/destructuring.js |
| index 731bc6dbe5c6c3a1b9fc10e80dcde7371c16bfb6..3c08623a53be814fdf43ad98b03ad89ac5d39558 100644 |
| --- a/test/mjsunit/harmony/destructuring.js |
| +++ b/test/mjsunit/harmony/destructuring.js |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| // |
| // Flags: --harmony-destructuring --harmony-computed-property-names |
| +// Flags: --harmony-arrow-functions |
| (function TestObjectLiteralPattern() { |
| var { x : x, y : y } = { x : 1, y : 2 }; |
| @@ -686,3 +687,24 @@ |
| assertEquals('ab', sx); |
| assertEquals('12', sy); |
| }()); |
| + |
| + |
| +(function TestParameters() { |
|
rossberg
2015/06/16 17:02:13
Can we have a few more tests? In particular, inclu
Dmitry Lomov (no reviews)
2015/06/19 15:25:14
Done.
|
| + function f({a, b}) { return a - b; } |
| + assertEquals(1, f({a : 6, b : 5})); |
| + |
| + function f1(c, {a, b}) { return c + a - b; } |
| + assertEquals(8, f1(7, {a : 6, b : 5})); |
| + |
| + var g = {a, b} => { return a - b; }; |
|
arv (Not doing code reviews)
2015/06/16 16:56:36
This should be a SyntaxError. Only when using a si
Dmitry Lomov (no reviews)
2015/06/19 15:25:14
Done.
|
| + assertEquals(1, g({a : 6, b : 5})); |
| + |
| + var g1 = (c, {a, b}) => { return c + a - b; }; |
| + assertEquals(8, g1(7, {a : 6, b : 5})); |
| + |
| + var h = {a, b} => a - b; |
|
rossberg
2015/06/16 17:02:13
AFAICT this is not legal ES6 syntax, see the gramm
Dmitry Lomov (no reviews)
2015/06/19 15:25:14
Done.
|
| + assertEquals(1, h({a : 6, b : 5})); |
| + |
| + var h1 = (c, {a, b}) => c + a - b; |
| + assertEquals(8, h1(7, {a : 6, b : 5})); |
| +}()); |