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

Unified Diff: test/mjsunit/harmony/generators-objects.js

Issue 13542002: Calling a generator function returns a generator object (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Fix nits; generator object fields are undefined if not set Created 7 years, 8 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 | « test/mjsunit/harmony/generators-instantiation.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/generators-objects.js
diff --git a/test/mjsunit/harmony/generators-instantiation.js b/test/mjsunit/harmony/generators-objects.js
similarity index 79%
rename from test/mjsunit/harmony/generators-instantiation.js
rename to test/mjsunit/harmony/generators-objects.js
index 1255f9705c479c5966cf916e378aef06033b8b7a..0c36818c8e04df37be72f46d71d8b8f33e4fb876 100644
--- a/test/mjsunit/harmony/generators-instantiation.js
+++ b/test/mjsunit/harmony/generators-objects.js
@@ -45,5 +45,24 @@ function TestContextAllocation() {
g4();
g5(["foo"]);
}
-
TestContextAllocation();
+
+
+// Test the properties and prototype of a generator object.
+function TestGeneratorObject() {
+ function* g() { yield 1; }
+
+ var iter = g();
+ assertSame(g.prototype, Object.getPrototypeOf(iter));
+ assertTrue(iter instanceof g);
+ assertEquals([], Object.getOwnPropertyNames(iter));
+ assertTrue(iter !== g());
+
+ // g() is the same as new g().
+ iter = new g();
+ assertSame(g.prototype, Object.getPrototypeOf(iter));
+ assertTrue(iter instanceof g);
+ assertEquals([], Object.getOwnPropertyNames(iter));
+ assertTrue(iter !== new g());
+}
+TestGeneratorObject();
« no previous file with comments | « test/mjsunit/harmony/generators-instantiation.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698