Index: test/mjsunit/harmony/generators-iteration.js |
diff --git a/test/mjsunit/harmony/generators-iteration.js b/test/mjsunit/harmony/generators-iteration.js |
index 1255f9705c479c5966cf916e378aef06033b8b7a..9cd895562183b586ad52f2458a6b616457b5f6d6 100644 |
--- a/test/mjsunit/harmony/generators-iteration.js |
+++ b/test/mjsunit/harmony/generators-iteration.js |
@@ -46,4 +46,23 @@ function TestContextAllocation() { |
g5(["foo"]); |
} |
+// Test the properties and prototype of an iterator. |
+function TestGeneratorIterator() { |
+ function* g() { yield 1; } |
+ |
+ var iterator = g(); |
+ assertSame(g.prototype, Object.getPrototypeOf(iterator)); |
+ assertTrue(iterator instanceof g); |
+ assertEquals([], Object.getOwnPropertyNames(iterator)); |
+ assertTrue(iterator !== g()); |
+ |
+ // g() is the same as new g(). |
+ iterator = new g(); |
+ assertSame(g.prototype, Object.getPrototypeOf(iterator)); |
+ assertTrue(iterator instanceof g); |
+ assertEquals([], Object.getOwnPropertyNames(iterator)); |
+ assertTrue(iterator !== new g()); |
+} |
+ |
TestContextAllocation(); |
+TestGeneratorIterator(); |