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

Unified Diff: test/mjsunit/es6/collections.js

Issue 949933002: ES6 collections: Fix order of constructor logic (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 5 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/weak-collection.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/collections.js
diff --git a/test/mjsunit/es6/collections.js b/test/mjsunit/es6/collections.js
index a66301462319befb51ec30a1ec04731d69b29ac7..989ded8a3e0fcb342ed632f64c5b9fd8a1521d08 100644
--- a/test/mjsunit/es6/collections.js
+++ b/test/mjsunit/es6/collections.js
@@ -1408,3 +1408,38 @@ TestCollectionToString(Map);
TestCollectionToString(Set);
TestCollectionToString(WeakMap);
TestCollectionToString(WeakSet);
+
+
+function TestConstructorOrderOfAdderIterator(ctor, adderName) {
+ var iterable = new Map();
+ iterable.set({}, {});
+ iterable.set({}, {});
+ var iterableFunction = iterable[Symbol.iterator];
+ Object.defineProperty(iterable, Symbol.iterator, {
+ get: function() {
+ log += 'iterator';
+ return iterableFunction;
+ }
+ });
+
+ var log = '';
+ var adderFunction = ctor.prototype[adderName];
+
+ Object.defineProperty(ctor.prototype, adderName, {
+ get: function() {
+ log += adderName;
+ return adderFunction;
+ }
+ });
+
+ new ctor(iterable);
+ assertEquals(adderName + 'iterator', log);
+
+ Object.defineProperty(ctor.prototype, adderName, {
+ value: adderFunction
+ });
+}
+TestConstructorOrderOfAdderIterator(Map, 'set');
+TestConstructorOrderOfAdderIterator(Set, 'add');
+TestConstructorOrderOfAdderIterator(WeakMap, 'set');
+TestConstructorOrderOfAdderIterator(WeakSet, 'add');
« no previous file with comments | « src/weak-collection.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698