diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/non262/Tuple/prototype/slice/tointeger-end.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/Tuple/prototype/slice/tointeger-end.js')
-rw-r--r-- | js/src/tests/non262/Tuple/prototype/slice/tointeger-end.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/js/src/tests/non262/Tuple/prototype/slice/tointeger-end.js b/js/src/tests/non262/Tuple/prototype/slice/tointeger-end.js new file mode 100644 index 0000000000..a379e5d7d3 --- /dev/null +++ b/js/src/tests/non262/Tuple/prototype/slice/tointeger-end.js @@ -0,0 +1,35 @@ +// |reftest| skip-if(!this.hasOwnProperty("Tuple")) +/* +8.2.3.5 +... +6. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToInteger(end). +*/ + +var obj = { + valueOf: function() { + return 2; + } +}; + + +var sample = #[40, 41, 42, 43]; + +assertEq(sample.slice(0, false), #[]); +assertEq(sample.slice(0, true), #[40]); + +assertEq(sample.slice(0, NaN), #[]); +assertEq(sample.slice(0, null), #[]); +assertEq(sample.slice(0, undefined), #[40, 41, 42, 43]); + +assertEq(sample.slice(0, 0.6), #[]); +assertEq(sample.slice(0, 1.1), #[40]); +assertEq(sample.slice(0, 1.5), #[40]); +assertEq(sample.slice(0, -0.6), #[]); +assertEq(sample.slice(0, -1.1), #[40, 41, 42]); +assertEq(sample.slice(0, -1.5), #[40, 41, 42]); + +assertEq(sample.slice(0, "3"), #[40, 41, 42]); + +assertEq(sample.slice(0, obj), #[40, 41]); + +reportCompare(0, 0); |