Index: test/mjsunit/harmony/destructuring.js |
diff --git a/test/mjsunit/harmony/destructuring.js b/test/mjsunit/harmony/destructuring.js |
index 0ddda04285b29cb645e1ff38db56226e6255d470..3cfb6fc528ec6f981108d16b271251b6a3c6e3b7 100644 |
--- a/test/mjsunit/harmony/destructuring.js |
+++ b/test/mjsunit/harmony/destructuring.js |
@@ -11,4 +11,46 @@ |
var {z} = { z : 3 }; |
assertEquals(3, z); |
+ |
+ |
+ var sum = 0; |
+ for(var {z} = { z : 3 }; z != 0; z--) { |
+ sum += z; |
+ } |
+ assertEquals(6, sum); |
+}()); |
+ |
+ |
+(function TestObjectLiteralPatternLexical() { |
+ 'use strict'; |
+ let { x : x, y : y } = { x : 1, y : 2 }; |
+ assertEquals(1, x); |
+ assertEquals(2, y); |
+ |
+ let {z} = { z : 3 }; |
+ assertEquals(3, z); |
+ |
+ |
+ let sum = 0; |
+ for(let {x, z} = { x : 0, z : 3 }; z != 0; z--) { |
+ assertEquals(0, x); |
+ sum += z; |
+ } |
+ assertEquals(6, sum); |
+}()); |
+ |
+ |
+(function TestObjectLiteralPatternLexicalConst() { |
+ 'use strict'; |
+ const { x : x, y : y } = { x : 1, y : 2 }; |
+ assertEquals(1, x); |
+ assertEquals(2, y); |
+ |
+ const {z} = { z : 3 }; |
+ assertEquals(3, z); |
+ |
+ |
+ for(const {x, z} = { x : 0, z : 3 }; z != 3 || x != 0;) { |
+ assertTrue(false); |
+ } |
}()); |