summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/prototype/map/this-not-iterator-throw.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/non262/Iterator/prototype/map/this-not-iterator-throw.js22
1 files changed, 22 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..aaed1f2617
--- /dev/null
+++ b/js/src/tests/non262/Iterator/prototype/map/this-not-iterator-throw.js
@@ -0,0 +1,22 @@
+// |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('', mapper), TypeError);
+assertThrowsInstanceOf(() => Iterator.prototype.map.call(new Symbol(''), mapper), TypeError);
+
+if (typeof reportCompare == 'function')
+ reportCompare(0, 0);