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

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: 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
« src/parser.cc ('K') | « 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..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);
+})();
« src/parser.cc ('K') | « 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