summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/AsyncIterator/prototype/forEach/interleaving-calls.js
blob: c8c47bde45b56dba542bbf728326c32107f0785d (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
// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator'))

const log = [];
async function* gen(n) {
  log.push(`${n}`);
  yield 1;
  log.push(`${n}`);
  yield 2;
}

Promise.all([gen(1).forEach(() => {}), gen(2).forEach(() => {})]).then(
  () => {
    assertEq(
      log.join(' '),
      '1 2 1 2',
    );
  },
  err => {
    throw err;
  }
);

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