From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- .../tests/basic/spread-call-not-iterable.js | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 js/src/jit-test/tests/basic/spread-call-not-iterable.js (limited to 'js/src/jit-test/tests/basic/spread-call-not-iterable.js') diff --git a/js/src/jit-test/tests/basic/spread-call-not-iterable.js b/js/src/jit-test/tests/basic/spread-call-not-iterable.js new file mode 100644 index 0000000000..969d99bccf --- /dev/null +++ b/js/src/jit-test/tests/basic/spread-call-not-iterable.js @@ -0,0 +1,28 @@ +load(libdir + "asserts.js"); +load(libdir + "iteration.js"); + +assertThrowsInstanceOf(() => Math.sin(...true), TypeError); +assertThrowsInstanceOf(() => Math.sin(...false), TypeError); +assertThrowsInstanceOf(() => Math.sin(...new Date()), TypeError); +assertThrowsInstanceOf(() => Math.sin(...Function("")), TypeError); +assertThrowsInstanceOf(() => Math.sin(...function () {}), TypeError); +assertThrowsInstanceOf(() => Math.sin(...(x => x)), TypeError); +assertThrowsInstanceOf(() => Math.sin(...1), TypeError); +assertThrowsInstanceOf(() => Math.sin(...{}), TypeError); +var foo = {} + +foo[Symbol.iterator] = 10; +assertThrowsInstanceOf(() => Math.sin(...foo), TypeError); + +foo[Symbol.iterator] = function() { return undefined; }; +assertThrowsInstanceOf(() => Math.sin(...foo), TypeError); + +foo[Symbol.iterator] = function() { return this; }; +assertThrowsInstanceOf(() => Math.sin(...foo), TypeError); + +foo[Symbol.iterator] = function() { return this; }; +foo.next = function() { throw 10; }; +assertThrowsValue(() => Math.sin(...foo), 10); + +assertThrowsInstanceOf(() => Math.sin(.../a/), TypeError); +assertThrowsInstanceOf(() => Math.sin(...new Error()), TypeError); -- cgit v1.2.3