Chromium Code Reviews| Index: test/mjsunit/harmony/destructuring.js |
| diff --git a/test/mjsunit/harmony/destructuring.js b/test/mjsunit/harmony/destructuring.js |
| index 92cd7762604f17f0012efe793b4530251dd43b40..dc417c70644cba38b38f7e3c106959bc9e2e2f8c 100644 |
| --- a/test/mjsunit/harmony/destructuring.js |
| +++ b/test/mjsunit/harmony/destructuring.js |
| @@ -1107,3 +1107,28 @@ |
| (function TestDestructuringArrayWithoutInitializer() { |
| assertThrows('var [foo]', TypeError); |
| })(); |
| + |
| + |
| +(function TestCatch() { |
| + "use strict"; |
| + |
| + 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); |
| + } |
| + |
| + // Should be lexically scoped inside catch scopes. |
| + assertEquals("undefined", typeof foo); |
|
rossberg
2015/11/03 12:00:50
This is not a sufficient test, because it will be
adamk
2015/11/03 20:35:20
Fixed.
Not sure how much more to test here, I'm n
rossberg
2015/11/04 10:26:56
Yeah, I think it's fine. Setting up the descriptor
|
| + assertEquals("undefined", typeof bar); |
| + assertEquals("undefined", typeof baz); |
| +})(); |