Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: test/mjsunit/harmony/destructuring.js

Issue 1417483014: [es6] Implement destructuring binding in try/catch (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix CheckConflictingVariableDeclarations to deal with destructuring Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/message/try-catch-variable-conflict.out ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+})();
« no previous file with comments | « test/message/try-catch-variable-conflict.out ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698