diff options
Diffstat (limited to 'js/src/jit-test/tests/for-of/generators-3.js')
-rw-r--r-- | js/src/jit-test/tests/for-of/generators-3.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/for-of/generators-3.js b/js/src/jit-test/tests/for-of/generators-3.js new file mode 100644 index 000000000..1d4cdccbe --- /dev/null +++ b/js/src/jit-test/tests/for-of/generators-3.js @@ -0,0 +1,18 @@ +// Nested for-of loops can use the same generator-iterator. + +function range(n) { + for (var i = 0; i < n; i++) + yield i; +} + +var r = range(10); +for (var a of r) + for (var b of r) + for (var c of r) + for (var d of r) + ; + +assertEq(a, 0); +assertEq(b, 1); +assertEq(c, 2); +assertEq(d, 9); |