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

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

Issue 1151503002: [destructuring] Implement spread binding patterns. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments addressed Created 5 years, 7 months 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/pattern-rewriter.cc ('K') | « test/cctest/test-parsing.cc ('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 978c8467aa8176f245f91a64078e821704c7e744..11a0bebcbfb29ac17d10d81a89de56e82b49d387 100644
--- a/test/mjsunit/harmony/destructuring.js
+++ b/test/mjsunit/harmony/destructuring.js
@@ -463,6 +463,34 @@
assertArrayEquals(["1", "2", "3"], log);
}());
+ (function() {
+ log = [];
+ var [a, ...rest] = f();
+ assertSame(1, a);
+ assertArrayEquals([2,3], rest);
+ assertArrayEquals(["1", "2", "3", "done"], log);
+ }());
+
+ (function() {
+ log = [];
+ var [a, b, c, ...rest] = f();
+ assertSame(1, a);
+ assertSame(2, b);
+ assertSame(3, c);
+ assertArrayEquals([], rest);
+ assertArrayEquals(["1", "2", "3", "done"], log);
+ }());
+
+ (function() {
+ log = [];
+ var [a, b, c, d, ...rest] = f();
+ assertSame(1, a);
+ assertSame(2, b);
+ assertSame(3, c);
+ assertSame(undefined, d);
+ assertArrayEquals([], rest);
+ assertArrayEquals(["1", "2", "3", "done"], log);
+ }());
}());
@@ -533,10 +561,37 @@
assertArrayEquals(["1", "2", "3"], log);
}());
+ (function() {
+ log = [];
+ let [a, ...rest] = f();
+ assertSame(1, a);
+ assertArrayEquals([2,3], rest);
+ assertArrayEquals(["1", "2", "3", "done"], log);
+ }());
+
+ (function() {
+ log = [];
+ let [a, b, c, ...rest] = f();
+ assertSame(1, a);
+ assertSame(2, b);
+ assertSame(3, c);
+ assertArrayEquals([], rest);
+ assertArrayEquals(["1", "2", "3", "done"], log);
+ }());
+
+ (function() {
+ log = [];
+ let [a, b, c, d, ...rest] = f();
+ assertSame(1, a);
+ assertSame(2, b);
+ assertSame(3, c);
+ assertSame(undefined, d);
+ assertArrayEquals([], rest);
+ assertArrayEquals(["1", "2", "3", "done"], log);
+ }());
}());
(function TestIteratorsRecursive() {
-
var log = [];
function* f() {
log.push("1");
« src/pattern-rewriter.cc ('K') | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698