Index: test/mjsunit/harmony/destructuring.js |
diff --git a/test/mjsunit/harmony/destructuring.js b/test/mjsunit/harmony/destructuring.js |
index 904058618ad23cb5520bba639a8fb14615b2c5ca..7192d7aa5b1cf05fcb51fe096eaf96d1ab06332b 100644 |
--- a/test/mjsunit/harmony/destructuring.js |
+++ b/test/mjsunit/harmony/destructuring.js |
@@ -1098,8 +1098,36 @@ |
function(){ eval("(class{foo(a, {}) {'use strict';}});") }, SyntaxError); |
})(); |
+ |
(function TestLegacyConstDestructuringInForLoop() { |
var result; |
for (const {foo} of [{foo: 1}]) { result = foo; } |
assertEquals(1, result); |
})(); |
+ |
+ |
+(function TestCatch() { |
+ "use strict"; |
+ |
+ // For testing proper scoping. |
+ var foo = "hello", bar = "world", baz = 42; |
+ |
+ try { |
+ throw {foo: 1, bar: 2}; |
+ } catch ({foo, bar, baz = 3}) { |
+ assertEquals(1, foo); |
+ assertEquals(2, bar); |
+ assertEquals(3, baz); |
+ } |
+ |
+ try { |
+ throw [1, 2, 3]; |
+ } catch ([foo, ...bar]) { |
+ assertEquals(1, foo); |
+ assertEquals([2, 3], bar); |
+ } |
+ |
+ assertEquals("hello", foo); |
+ assertEquals("world", bar); |
+ assertEquals(42, baz); |
+})(); |