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

async function* gen() {
  yield 1;
  yield 2;
  yield 3;
}

let iter = gen().asIndexedPairs();

for (const v of [[0, 1], [1, 2], [2, 3]]) {
  iter.next().then(
    result => {
      console.log(result);
      assertEq(result.done, false);
      assertEq(result.value[0], v[0]);
      assertEq(result.value[1], v[1]);
    }
  );
}

iter.next().then(({done}) => assertEq(done, true));

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