diff options
Diffstat (limited to 'js/src/tests/non262/Tuple/from/calling-from-valid-1-onlyStrict-strict.js')
-rw-r--r-- | js/src/tests/non262/Tuple/from/calling-from-valid-1-onlyStrict-strict.js | 44 |
1 files changed, 44 insertions, 0 deletions
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); |