blob: 0fbeb995f174bcd1a80622c1a3a8ea995296830b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally
class TestIterator extends Iterator {
next() {
throw new Error();
}
closed = false;
return() {
this.closed = true;
}
}
const sum = (x, y) => x + y;
const iter = new TestIterator();
assertEq(iter.closed, false);
assertThrowsInstanceOf(() => iter.reduce(sum), Error);
assertEq(iter.closed, false);
if (typeof reportCompare === 'function')
reportCompare(0, 0);
|