diff options
Diffstat (limited to 'js/src/tests/js1_7/geniter/yield-new.js')
-rw-r--r-- | js/src/tests/js1_7/geniter/yield-new.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/tests/js1_7/geniter/yield-new.js b/js/src/tests/js1_7/geniter/yield-new.js new file mode 100644 index 000000000..726da3944 --- /dev/null +++ b/js/src/tests/js1_7/geniter/yield-new.js @@ -0,0 +1,28 @@ +const K = 20; + +var obj; + +var g = new function() { + this.x = "puppies"; + obj = this; + for (var i = 0; i < K; ++i) + yield i; + yield this; +} + +var ct = 0; +for (var i in g) + assertEq((ct < K && ct++ == i) || i == obj, true); +assertEq(i.x, "puppies"); + +function g2() { + for (var i=0; i<20; i++) + yield i; +} +var i = 0; +for (var x of new g2()) { + assertEq(i, x); + i++; +} + +reportCompare(true,true); |