From 455b9a032a26335882e6c83bcda2e50eb12ff4a0 Mon Sep 17 00:00:00 2001 From: G-Lee1031 Date: Fri, 30 Jan 2026 13:53:48 +0900 Subject: [PATCH] Added test case where Array.from throws. --- .../Array/from/from-throws-construct.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/built-ins/Array/from/from-throws-construct.js diff --git a/test/built-ins/Array/from/from-throws-construct.js b/test/built-ins/Array/from/from-throws-construct.js new file mode 100644 index 00000000000..96fea2fcdae --- /dev/null +++ b/test/built-ins/Array/from/from-throws-construct.js @@ -0,0 +1,20 @@ +// Copyright (C) 2026 Garham Lee. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.from +description: > + Array.from throws in construct operation. +info: | + Array.from ( _items_ [ , _mapper_ [ , _thisArg_ ] ] ) + + 1. Let _C_ be the *this* value. + + 7. Let _arrayLike_ be ! ToObject(_items_). + 8. Let _len_ be ? LengthOfArrayLike(_arrayLike_). + 9. If IsConstructor(_C_) is *true*, then + a. Let _A_ be ? Construct(_C_, « 𝔽(_len_) »). +---*/ +assert.throws(Test262Error, function () { + Array.from.call(function() {throw new Test262Error}, 0); +}, "Array.from throws")