summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Tuple/prototype/slice/tointeger-end.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/non262/Tuple/prototype/slice/tointeger-end.js35
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);