summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/from/o-not-object-throws.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/non262/Iterator/from/o-not-object-throws.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/src/tests/non262/Iterator/from/o-not-object-throws.js b/js/src/tests/non262/Iterator/from/o-not-object-throws.js
new file mode 100644
index 0000000000..3e6c00e59a
--- /dev/null
+++ b/js/src/tests/non262/Iterator/from/o-not-object-throws.js
@@ -0,0 +1,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);