summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/from/o-not-object-throws.js
blob: 3e6c00e59afee840a18e7f7157acb307ed1c3cab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally
/*---
  Iterator.from throws when called with a non-object.
---*/

assertThrowsInstanceOf(() => Iterator.from(undefined), TypeError);
assertThrowsInstanceOf(() => Iterator.from(null), TypeError);
assertThrowsInstanceOf(() => Iterator.from(0), TypeError);
assertThrowsInstanceOf(() => Iterator.from(false), TypeError);
assertThrowsInstanceOf(() => Iterator.from(Symbol('')), TypeError);

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