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(); |