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

Unified Diff: test/mjsunit/es6/mirror-iterators.js

Issue 710273002: Expose internal properties of map/set iterators via mirrors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 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 | « src/runtime/runtime-collections.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/mirror-iterators.js
diff --git a/test/mjsunit/es6/mirror-iterators.js b/test/mjsunit/es6/mirror-iterators.js
index cc0b1e45f893139caa73238d48cf63e5463001ea..22ce42493f114cb7585b85a9a3b5a07ea476156b 100644
--- a/test/mjsunit/es6/mirror-iterators.js
+++ b/test/mjsunit/es6/mirror-iterators.js
@@ -23,6 +23,22 @@ function testIteratorMirror(iter, offset, expected, opt_limit) {
assertArrayEquals(expected, values);
}
+function testIteratorInternalProperties(iter, offset, kind, index, has_more) {
+ while (offset-- > 0) iter.next();
+
+ var mirror = debug.MakeMirror(iter);
+ assertTrue(mirror.isIterator());
+
+ var properties = mirror.internalProperties();
+ assertEquals(3, properties.length);
+ assertEquals("[[IteratorHasMore]]", properties[0].name());
+ assertEquals(has_more, properties[0].value().value());
+ assertEquals("[[IteratorIndex]]", properties[1].name());
+ assertEquals(index, properties[1].value().value());
+ assertEquals("[[IteratorKind]]", properties[2].name());
+ assertEquals(kind, properties[2].value().value());
+}
+
var o1 = { foo: 1 };
var o2 = { foo: 2 };
@@ -47,6 +63,11 @@ testIteratorMirror(map.keys(), 0, [41], 1);
testIteratorMirror(map.values(), 0, [42], 1);
testIteratorMirror(map.entries(), 0, [[41, 42]], 1);
+testIteratorInternalProperties(map.keys(), 0, "keys", 0, true);
+testIteratorInternalProperties(map.values(), 1, "values", 1, true);
+testIteratorInternalProperties(map.entries(), 2, "entries", 2, false);
+testIteratorInternalProperties(map.keys(), 3, "keys", 2, false);
+
var set = new Set();
set.add(41);
set.add(42);
@@ -73,3 +94,10 @@ testIteratorMirror(set.entries(), 5, []);
testIteratorMirror(set.keys(), 1, [42, o1], 2);
testIteratorMirror(set.values(), 1, [42, o1], 2);
testIteratorMirror(set.entries(), 1, [[42, 42], [o1, o1]], 2);
+
+testIteratorInternalProperties(set.keys(), 0, "values", 0, true);
+testIteratorInternalProperties(set.values(), 1, "values", 1, true);
+testIteratorInternalProperties(set.entries(), 2, "entries", 2, true);
+testIteratorInternalProperties(set.keys(), 3, "values", 3, true);
+testIteratorInternalProperties(set.values(), 4, "values", 4, false);
+testIteratorInternalProperties(set.entries(), 5, "entries", 4, false);
« no previous file with comments | « src/runtime/runtime-collections.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698