From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../from/calling-from-valid-1-onlyStrict-strict.js | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 js/src/tests/non262/Tuple/from/calling-from-valid-1-onlyStrict-strict.js (limited to 'js/src/tests/non262/Tuple/from/calling-from-valid-1-onlyStrict-strict.js') diff --git a/js/src/tests/non262/Tuple/from/calling-from-valid-1-onlyStrict-strict.js b/js/src/tests/non262/Tuple/from/calling-from-valid-1-onlyStrict-strict.js new file mode 100644 index 0000000000..79914f4fd6 --- /dev/null +++ b/js/src/tests/non262/Tuple/from/calling-from-valid-1-onlyStrict-strict.js @@ -0,0 +1,44 @@ +// |reftest| skip-if(!this.hasOwnProperty("Tuple")) +'use strict'; + +var list = { + '0': 41, + '1': 42, + '2': 43, + length: 3 +}; +var calls = []; + +function mapFn(value) { + calls.push({ + args: arguments, + thisArg: this + }); + return value * 2; +} + +var result = Tuple.from(list, mapFn); + +assertEq(result.length, 3); +assertEq(result[0], 82); +assertEq(result[1], 84); +assertEq(result[2], 86); + +assertEq(calls.length, 3); + +assertEq(calls[0].args.length, 2); +assertEq(calls[0].args[0], 41); +assertEq(calls[0].args[1], 0); +assertEq(calls[0].thisArg, undefined); + +assertEq(calls[1].args.length, 2); +assertEq(calls[1].args[0], 42); +assertEq(calls[1].args[1], 1); +assertEq(calls[1].thisArg, undefined); + +assertEq(calls[2].args.length, 2); +assertEq(calls[2].args[0], 43); +assertEq(calls[2].args[1], 2); +assertEq(calls[2].thisArg, undefined); + +reportCompare(0, 0); -- cgit v1.2.3