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

Side by Side Diff: test/mjsunit/es6/mirror-iterators.js

Issue 693813002: Add debug mirror support for ES6 Map/Set iterators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: added v8::Value::IsMapIterator and v8::Value::IsSetIterator 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 unified diff | Download patch | Annotate | Revision Log
« src/factory.cc ('K') | « src/runtime/runtime-collections.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --expose-debug-as debug
6 // Test the mirror object for collection iterators.
7
8 function testIteratorMirror(iter, expected) {
9 var mirror = debug.MakeMirror(iter);
10 assertTrue(mirror.isIterator());
11
12 var preview = mirror.preview();
13 assertArrayEquals(expected, preview);
14
15 // Check that iterator has not changed after taking preview.
16 var values = [];
17 for (var i of iter) values.push(i);
18 assertArrayEquals(expected, values);
19 }
20
21 var o1 = { foo: 1 };
22 var o2 = { foo: 2 };
23
24 var map = new Map();
25 map.set(41, 42);
26 map.set(o1, o2);
27 testIteratorMirror(map.keys(), [41, o1]);
28 testIteratorMirror(map.values(), [42, o2]);
29 testIteratorMirror(map.entries(), [[41, 42], [o1, o2]]);
30
31 var set = new Set();
32 set.add(41);
33 set.add(42);
34 set.add(o1);
35 set.add(o2);
36 testIteratorMirror(set.keys(), [41, 42, o1, o2]);
37 testIteratorMirror(set.values(), [41, 42, o1, o2]);
38 testIteratorMirror(set.entries(), [[41, 41], [42, 42], [o1, o1], [o2, o2]]);
arv (Not doing code reviews) 2014/10/31 10:20:18 I think it would be good to have a test that crea
aandrey 2014/10/31 10:43:22 Done.
OLDNEW
« src/factory.cc ('K') | « src/runtime/runtime-collections.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698