summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/AsyncIterator/prototype/every/fn-not-callable-throws.js
blob: 025c46dfdf6d9d6472be1b03af2219eb4031cfe3 (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
// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator'))

async function *gen() {
  yield 1;
}

function check(fn) {
  gen().every(fn).then(() => {
    throw new Error('every should have thrown');
  },
  (err) => {
    assertEq(err instanceof TypeError, true);
  });
}

check();
check(undefined);
check(null);
check(0);
check(false);
check('');
check(Symbol(''));
check({});

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