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

Side by Side Diff: test/mjsunit/harmony/array-from-generators.js

Issue 363833006: Implement Array.from() (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Disable generators tests for TurboFan Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
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: --harmony-arrays --harmony-generators
6 (function() {
7
8 assertEquals(1, Array.from.length);
9
10 function testArrayFrom(thisArg, constructor) {
11 assertArrayLikeEquals(Array.from.call(thisArg, generator()), ['a', 'b', 'c'], constructor);
12 }
13
14 testArrayFrom(Array, Array);
15 testArrayFrom(null, Array);
16 testArrayFrom({}, Array);
17 testArrayFrom(Object, Object);
18 testArrayFrom(Other, Other);
19
20 function Other() {}
21
22 function* generator() {
arv (Not doing code reviews) 2014/09/05 18:04:54 Move this up, before the first usage.
23 yield 'a';
24 yield 'b';
25 yield 'c';
26 }
27
28 function assertArrayLikeEquals(value, expected, type) {
29 assertInstanceof(value, type);
30 assertEquals(expected.length, value.length);
31 for (var i=0; i<value.length; ++i) {
32 assertEquals(expected[i], value[i]);
33 }
34 }
35
36 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698