summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/AsyncIterator/prototype/every/coerce-result-to-boolean.js
blob: 35c40d235ee0dd6d72d36657a3bae0379ccfc95c (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
// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator'))

async function* gen(value) {
  yield value;
}
const fn = x => x;
function check(value, expected) {
  gen(value).every(fn).then(result => assertEq(result, expected));
}

check(true, true);
check(1, true);
check([], true);
check({}, true);
check('test', true);

check(false, false);
check(0, false);
check('', false);
check(null, false);
check(undefined, false);
check(NaN, false);
check(-0, false);
check(0n, false);
check(createIsHTMLDDA(), false);
check(Promise.resolve(false), false);

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