summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/prototype/map/this-not-iterator-throw.js
blob: ac250db383dee2c451670832dc5cb026d56c68f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// |reftest| skip-if(!this.hasOwnProperty('Iterator'))
//

/*---
esid: pending
description: Eagerly throw TypeError when `this` is not an iterator.
info:
features: [iterator-helpers]
---*/

const mapper = (x) => x;

assertThrowsInstanceOf(() => Iterator.prototype.map.call(undefined, mapper), TypeError);
assertThrowsInstanceOf(() => Iterator.prototype.map.call(null, mapper), TypeError);
assertThrowsInstanceOf(() => Iterator.prototype.map.call(0, mapper), TypeError);
assertThrowsInstanceOf(() => Iterator.prototype.map.call(false, mapper), TypeError);
assertThrowsInstanceOf(() => Iterator.prototype.map.call('', mapper), TypeError);
assertThrowsInstanceOf(() => Iterator.prototype.map.call(new Symbol(''), mapper), TypeError);

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