diff options
Diffstat (limited to 'js/src/tests/non262/Iterator/prototype/forEach/fn-not-callable-throws.js')
-rw-r--r-- | js/src/tests/non262/Iterator/prototype/forEach/fn-not-callable-throws.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/js/src/tests/non262/Iterator/prototype/forEach/fn-not-callable-throws.js b/js/src/tests/non262/Iterator/prototype/forEach/fn-not-callable-throws.js new file mode 100644 index 0000000000..473789a6a2 --- /dev/null +++ b/js/src/tests/non262/Iterator/prototype/forEach/fn-not-callable-throws.js @@ -0,0 +1,15 @@ +// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally + +const iter = [].values(); + +assertThrowsInstanceOf(() => iter.forEach(), TypeError); +assertThrowsInstanceOf(() => iter.forEach(undefined), TypeError); +assertThrowsInstanceOf(() => iter.forEach(null), TypeError); +assertThrowsInstanceOf(() => iter.forEach(0), TypeError); +assertThrowsInstanceOf(() => iter.forEach(false), TypeError); +assertThrowsInstanceOf(() => iter.forEach(''), TypeError); +assertThrowsInstanceOf(() => iter.forEach(Symbol('')), TypeError); +assertThrowsInstanceOf(() => iter.forEach({}), TypeError); + +if (typeof reportCompare === 'function') + reportCompare(0, 0); |