summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/AsyncIterator/prototype/lazy-methods-throw-on-reentry.js
blob: d7a582c6c164c70a5ad44a742b893c2b7c86c15f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator'))

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

const methods = ['map', 'filter', 'flatMap'];

for (const method of methods) {
  const iter = gen('value');
  const iterHelper = iter[method](x => iterHelper.next());
  iterHelper.next().then(
    _ => assertEq(true, false, 'Expected reject.'),
    err => assertEq(err instanceof TypeError, true),
  );
}

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