summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/prototype/forEach/fn-not-callable-throws.js
blob: 473789a6a240eba3d3e97d012db4791a74df55c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally

const iter = [].values();

assertThrowsInstanceOf(() => iter.forEach(), TypeError);
assertThrowsInstanceOf(() => iter.forEach(undefined), TypeError);
assertThrowsInstanceOf(() => iter.forEach(null), TypeError);
assertThrowsInstanceOf(() => iter.forEach(0), TypeError);
assertThrowsInstanceOf(() => iter.forEach(false), TypeError);
assertThrowsInstanceOf(() => iter.forEach(''), TypeError);
assertThrowsInstanceOf(() => iter.forEach(Symbol('')), TypeError);
assertThrowsInstanceOf(() => iter.forEach({}), TypeError);

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