summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/prototype/map/mapper-not-callable-throw.js
blob: 334e0fd8f92e9daf27c14d74d76f4a7da2011450 (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
26
27
28
29
30
31
32
33
// |reftest| skip-if(!this.hasOwnProperty('Iterator'))
//

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

assertThrowsInstanceOf(() => Iterator.prototype.map(undefined), TypeError);
assertThrowsInstanceOf(() => [].values().map(undefined), TypeError);

assertThrowsInstanceOf(() => Iterator.prototype.map(null), TypeError);
assertThrowsInstanceOf(() => [].values().map(null), TypeError);

assertThrowsInstanceOf(() => Iterator.prototype.map(0), TypeError);
assertThrowsInstanceOf(() => [].values().map(0), TypeError);

assertThrowsInstanceOf(() => Iterator.prototype.map(false), TypeError);
assertThrowsInstanceOf(() => [].values().map(false), TypeError);

assertThrowsInstanceOf(() => Iterator.prototype.map({}), TypeError);
assertThrowsInstanceOf(() => [].values().map({}), TypeError);

assertThrowsInstanceOf(() => Iterator.prototype.map(''), TypeError);
assertThrowsInstanceOf(() => [].values().map(''), TypeError);

assertThrowsInstanceOf(() => Iterator.prototype.map(Symbol('')), TypeError);
assertThrowsInstanceOf(() => [].values().map(Symbol('')), TypeError);

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