summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/AsyncIterator/prototype/iterator-helper-methods-throw-on-generators.js
blob: f79fb7d8425c59645748af9b04e1945f684d9092 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator'))

async function *gen() { yield 'value'; }

const asyncIteratorHelperProto = Object.getPrototypeOf(gen().map(x => x));

assertThrowsInstanceOf(() => asyncIteratorHelperProto.next.call(gen()), TypeError);
assertThrowsInstanceOf(() => asyncIteratorHelperProto.return.call(gen()), TypeError);
assertThrowsInstanceOf(() => asyncIteratorHelperProto.throw.call(gen()), TypeError);

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