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

let x = {a: () => true};

async function* gen() {
  yield x.a();
  yield x.a();
}

gen().toArray().then(
  () => assertEq(true, false, 'expected error'),
  err => assertEq(err instanceof Error, true),
);

x.a = () => {
  throw Error();
};

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