Index: test/mjsunit/harmony/destructuring.js |
diff --git a/test/mjsunit/harmony/destructuring.js b/test/mjsunit/harmony/destructuring.js |
index 92cd7762604f17f0012efe793b4530251dd43b40..faf3a98a6232ab22f8be5f813f88e32996b86396 100644 |
--- a/test/mjsunit/harmony/destructuring.js |
+++ b/test/mjsunit/harmony/destructuring.js |
@@ -1107,3 +1107,30 @@ |
(function TestDestructuringArrayWithoutInitializer() { |
assertThrows('var [foo]', TypeError); |
})(); |
+ |
+ |
+(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); |
+})(); |