blob: 0db7cf6f61fc30672b0d0b160d14d20a873f2cbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally
const iter = {
next: () => ({ done: false, value: 0 }),
throw: (value) => ({ done: true, value }),
};
const wrap = Iterator.from(iter);
let {done, value} = wrap.throw(0);
assertEq(done, true);
assertEq(value, 0);
class TestError extends Error {}
iter.throw = () => { throw new TestError(); };
assertThrowsInstanceOf(() => wrap.throw(), TestError);
if (typeof reportCompare === 'function')
reportCompare(0, 0);
|