summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/AsyncIterator/prototype/reduce/this-not-iterator-throws.js
blob: 7f95920fbdf5772bba6f323378ad60b68c91e64c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator')) 

const sum = (x, y) => x + y;
function check(x) {
  AsyncIterator.prototype.reduce.call(x, sum).then(
    () => assertEq(true, false, 'expected error'),
    err => {
      assertEq(err instanceof TypeError, true);
    }
  );
}

check();
check(undefined);
check({});
check({next: 0});

if (typeof reportCompare === 'function')
  reportCompare(0, 0);