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

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

Issue 1704533002: Support rest element pattern with user-defined iterable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | test/mjsunit/harmony/destructuring-assignment.js » ('j') | 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 50f27857ec04ce302dacb2ab63139ac27167f61c..8a03143e0401367f96de87a887d288eeb4698c84 100644
--- a/test/mjsunit/harmony/destructuring.js
+++ b/test/mjsunit/harmony/destructuring.js
@@ -503,6 +503,28 @@
}());
+(function TestRestCustomIterable() {
+ var idx = 0;
+ var iterable = {};
+ var iterator = {
+ next: function() {
+ idx += 1;
+ return {
+ value: idx,
+ done: idx === 4
+ };
+ }
+ };
+ iterable[Symbol.iterator] = function() {
+ return iterator;
+ };
+
+ var [...result] = iterable;
+
+ assertEquals([1, 2, 3], result);
+}());
+
+
(function TestIteratorsLexical() {
'use strict';
var log = [];
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | test/mjsunit/harmony/destructuring-assignment.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698