blob: 57c244d603c1a7f49c0206e4b9b16dadda7c7f89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator'))
class TestIterator extends AsyncIterator {
constructor(value) {
super();
this.value = value;
}
next() {
return Promise.resolve(this.value);
}
}
const sum = (x, y) => x + y;
function check(value) {
const iter = new TestIterator(value);
iter.reduce(sum).then(() => assertEq(true, false, 'expected error'), err => {
assertEq(err instanceof TypeError, true);
});
}
check();
check(undefined);
check(null);
check(0);
check(false);
check('');
check(Symbol(''));
if (typeof reportCompare === 'function')
reportCompare(0, 0);
|