diff options
Diffstat (limited to 'js/src/tests/non262/Iterator/prototype/map/this-not-iterator-throw.js')
-rw-r--r-- | js/src/tests/non262/Iterator/prototype/map/this-not-iterator-throw.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/js/src/tests/non262/Iterator/prototype/map/this-not-iterator-throw.js b/js/src/tests/non262/Iterator/prototype/map/this-not-iterator-throw.js new file mode 100644 index 0000000000..ac250db383 --- /dev/null +++ b/js/src/tests/non262/Iterator/prototype/map/this-not-iterator-throw.js @@ -0,0 +1,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); |