diff options
Diffstat (limited to 'js/src/tests/non262/Iterator/from/wrap-next-not-object-throws.js')
-rw-r--r-- | js/src/tests/non262/Iterator/from/wrap-next-not-object-throws.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/js/src/tests/non262/Iterator/from/wrap-next-not-object-throws.js b/js/src/tests/non262/Iterator/from/wrap-next-not-object-throws.js new file mode 100644 index 0000000000..0e5b559f3b --- /dev/null +++ b/js/src/tests/non262/Iterator/from/wrap-next-not-object-throws.js @@ -0,0 +1,14 @@ +// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally +const iter = (value) => Iterator.from({ + next: () => value, +}); + +assertThrowsInstanceOf(() => iter(undefined).next(), TypeError); +assertThrowsInstanceOf(() => iter(null).next(), TypeError); +assertThrowsInstanceOf(() => iter(0).next(), TypeError); +assertThrowsInstanceOf(() => iter(false).next(), TypeError); +assertThrowsInstanceOf(() => iter('test').next(), TypeError); +assertThrowsInstanceOf(() => iter(Symbol('')).next(), TypeError); + +if (typeof reportCompare === 'function') + reportCompare(0, 0); |