summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/AsyncIterator/prototype/reduce/reduce.js
blob: d2382e4d53b3da1075e0f6b600301c3a609954fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator')) 

const reducer = (acc, value) => acc + value;
async function* gen() {
  yield 1;
  yield 2;
  yield 3;
}

gen().reduce(reducer, 0).then(result => assertEq(result, 6));

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