blob: b4059251db0c757b537fa3a74e77db6638b630db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
// Manually advancing the iterator.
load(libdir + 'iteration.js');
function* g(n) { for (var i=0; i<n; i++) yield i; }
var inner = g(20);
var n = 0;
for (var x of inner) {
assertEq(x, n * 2);
assertIteratorNext(inner, n * 2 + 1);
n++;
}
assertEq(n, 10);
|