summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Tuple/prototype/indexOf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/non262/Tuple/prototype/indexOf
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.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/indexOf')
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/empty-tuple.js13
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-boolean.js14
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-float.js15
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-greater-than-length.js17
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-infinity-string.js13
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-inherited-valueOf.js36
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-missing.js17
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-nan.js15
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-neg-infinity.js13
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-neg-zero.js14
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-negative.js16
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-null.js15
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-number.js14
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-not-primitive.js33
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-valueOf-toString.js31
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-valueOf.js21
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object.js24
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-positive.js16
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-side-effects-3.js23
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-2.js14
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-exponent.js16
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-hex.js17
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-leading-zeros.js16
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-neg-infinity.js13
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-negative.js14
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string.js14
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-trunc-2.js17
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-trunc.js17
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-undefined.js14
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-with-index.js17
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-zero.js13
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/includes.js18
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/length-internal.js14
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/length.js27
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/undefined-throws-type-error.js18
-rw-r--r--js/src/tests/non262/Tuple/prototype/indexOf/uses-internal-length.js17
36 files changed, 636 insertions, 0 deletions
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/empty-tuple.js b/js/src/tests/non262/Tuple/prototype/indexOf/empty-tuple.js
new file mode 100644
index 0000000000..1334ba9271
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/empty-tuple.js
@@ -0,0 +1,13 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Tuple.prototype.indexOf returns -1 if 'length' is 0 (empty tuple)
+---*/
+
+var i = #[].indexOf(42);
+
+assertEq(i, -1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-boolean.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-boolean.js
new file mode 100644
index 0000000000..41c064370b
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-boolean.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Tuple.prototype.indexOf when fromIndex is boolean
+---*/
+
+let a = #[1, 2, 3];
+
+assertEq(a.indexOf(1, true), -1);
+assertEq(a.indexOf(1, false), 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-float.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-float.js
new file mode 100644
index 0000000000..1c2995a0af
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-float.js
@@ -0,0 +1,15 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Tuple.prototype.indexOf when fromIndex is floating point number
+---*/
+
+var a = #[1,2,3];
+
+assertEq(a.indexOf(3, 0.49), 2);
+assertEq(a.indexOf(1, 0.51), 0);
+assertEq(a.indexOf(1, 1.51), -1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-greater-than-length.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-greater-than-length.js
new file mode 100644
index 0000000000..3514d0a444
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-greater-than-length.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf returns -1 if fromIndex is greater than
+ Tuple length
+---*/
+
+let a = #[1, 2, 3];
+
+assertEq(a.indexOf(1, 5), -1);
+assertEq(a.indexOf(1, 3), -1);
+assertEq(#[].indexOf(1, 0), -1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-infinity-string.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-infinity-string.js
new file mode 100644
index 0000000000..de5895aca3
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-infinity-string.js
@@ -0,0 +1,13 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a string
+ containing -Infinity
+---*/
+
+assertEq(#[true].indexOf(true, "-Infinity"), 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-inherited-valueOf.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-inherited-valueOf.js
new file mode 100644
index 0000000000..a2ad8353bf
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-inherited-valueOf.js
@@ -0,0 +1,36 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.indexof
+description: >
+ Tuple.prototype.indexOf uses inherited valueOf method when value
+ of 'fromIndex' is an object with an own toString and inherited
+ valueOf methods
+---*/
+
+var toStringAccessed = false;
+var valueOfAccessed = false;
+
+var proto = {
+ valueOf: function() {
+ valueOfAccessed = true;
+ return 1;
+ }
+};
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child.toString = function() {
+ toStringAccessed = true;
+ return 2;
+};
+
+assertEq(#[0, true].indexOf(true, child), 1, '[0, true].indexOf(true, child)');
+assertEq(valueOfAccessed, true);
+assertEq(toStringAccessed, false, 'toStringAccessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-missing.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-missing.js
new file mode 100644
index 0000000000..6a16da4847
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-missing.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.indexof
+description: Tuple.prototype.indexOf - 'fromIndex' isn't passed
+---*/
+
+var arr = #[0, 1, 2, 3, 4];
+//'fromIndex' will be set as 0 if not passed by default
+
+assertEq(arr.indexOf(0), arr.indexOf(0, 0), 'arr.indexOf(0)');
+assertEq(arr.indexOf(2), arr.indexOf(2, 0), 'arr.indexOf(2)');
+assertEq(arr.indexOf(4), arr.indexOf(4, 0), 'arr.indexOf(4)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-nan.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-nan.js
new file mode 100644
index 0000000000..40fdde8a34
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-nan.js
@@ -0,0 +1,15 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.indexof
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a number (value
+ is NaN)
+---*/
+
+assertEq(#[true].indexOf(true, NaN), 0, '[true].indexOf(true, NaN)');
+assertEq(#[true].indexOf(true, -NaN), 0, '[true].indexOf(true, -NaN)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-neg-infinity.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-neg-infinity.js
new file mode 100644
index 0000000000..4595230e83
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-neg-infinity.js
@@ -0,0 +1,13 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a number (value
+ is -Infinity)
+---*/
+
+assertEq(#[true].indexOf(true, -Infinity), 0, '#[true].indexOf(true, -Infinity)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-neg-zero.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-neg-zero.js
new file mode 100644
index 0000000000..2d0d856f4f
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-neg-zero.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.indexof
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a number (value
+ is -0)
+---*/
+
+assertEq(#[true].indexOf(true, -0), 0, '#[true].indexOf(true, -0)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-negative.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-negative.js
new file mode 100644
index 0000000000..db87f171d2
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-negative.js
@@ -0,0 +1,16 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a number (value
+ is negative number)
+---*/
+
+var target = #[];
+
+assertEq(#[0, target, 2].indexOf(target, -1), -1, '[0, target, 2].indexOf(target, -1)');
+assertEq(#[0, 1, target].indexOf(target, -1), 2, '[0, 1, target].indexOf(target, -1)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-null.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-null.js
new file mode 100644
index 0000000000..f046fe2398
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-null.js
@@ -0,0 +1,15 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.indexof
+description: Tuple.prototype.indexOf returns 0 if fromIndex is null
+---*/
+
+var a = #[1, 2, 3];
+
+// null resolves to 0
+assertEq(a.indexOf(1, null), 0, 'a.indexOf(1,null)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-number.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-number.js
new file mode 100644
index 0000000000..8fc53c3a5a
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-number.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.indexof
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a number (value
+ is 0)
+---*/
+
+assertEq(#[true].indexOf(true, 0), 0, '#[true].indexOf(true, 0)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-not-primitive.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-not-primitive.js
new file mode 100644
index 0000000000..946dc411fc
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-not-primitive.js
@@ -0,0 +1,33 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf throws TypeError exception when value of
+ 'fromIndex' is an object with toString and valueOf methods that
+ don�t return primitive values
+---*/
+
+var toStringAccessed = false;
+var valueOfAccessed = false;
+var fromIndex = {
+ toString: function() {
+ toStringAccessed = true;
+ return {};
+ },
+
+ valueOf: function() {
+ valueOfAccessed = true;
+ return {};
+ }
+};
+
+assertThrowsInstanceOf(function() {
+ #[0, true].indexOf(true, fromIndex);
+}, TypeError);
+
+assertEq(toStringAccessed, true);
+assertEq(valueOfAccessed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-valueOf-toString.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-valueOf-toString.js
new file mode 100644
index 0000000000..5568a31bdf
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-valueOf-toString.js
@@ -0,0 +1,31 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is an object that
+ has an own valueOf method that returns an object and toString
+ method that returns a string
+---*/
+
+var toStringAccessed = false;
+var valueOfAccessed = false;
+
+var fromIndex = {
+ toString: function() {
+ toStringAccessed = true;
+ return '1';
+ },
+
+ valueOf: function() {
+ valueOfAccessed = true;
+ return {};
+ }
+};
+
+assertEq(#[0, true].indexOf(true, fromIndex), 1, '#[0, true].indexOf(true, fromIndex)');
+assertEq(toStringAccessed, true);
+assertEq(valueOfAccessed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-valueOf.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-valueOf.js
new file mode 100644
index 0000000000..c69aadaefb
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object-valueOf.js
@@ -0,0 +1,21 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.indexof
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is an Object, which
+ has an own valueOf method
+---*/
+
+var fromIndex = {
+ valueOf: function() {
+ return 1;
+ }
+};
+
+
+assertEq(#[0, true].indexOf(true, fromIndex), 1, '#[0, true].indexOf(true, fromIndex)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object.js
new file mode 100644
index 0000000000..cb1d74ddf8
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-object.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is an Object, which
+ has an own toString method
+---*/
+
+// objects inherit the default valueOf() method from Object
+// that simply returns itself. Since the default valueOf() method
+// does not return a primitive value, ES next tries to convert the object
+// to a number by calling its toString() method and converting the
+// resulting string to a number.
+var fromIndex = {
+ toString: function() {
+ return '1';
+ }
+};
+
+assertEq(#[0, true].indexOf(true, fromIndex), 1, '#[0, true].indexOf(true, fromIndex)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-positive.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-positive.js
new file mode 100644
index 0000000000..c5b1948356
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-positive.js
@@ -0,0 +1,16 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a number (value
+ is positive number)
+---*/
+
+var target = #[];
+
+assertEq(#[0, target, 2].indexOf(target, 2), -1, '#[0, target, 2].indexOf(target, 2)');
+assertEq(#[0, 1, target].indexOf(target, 2), 2, '#[0, 1, target].indexOf(target, 2)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-side-effects-3.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-side-effects-3.js
new file mode 100644
index 0000000000..b2a98cc58a
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-side-effects-3.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - side effects produced by step 1 are
+ visible when an exception occurs
+---*/
+
+var stepFiveOccurs = false;
+var fromIndex = {
+ valueOf: function() {
+ stepFiveOccurs = true;
+ return 0;
+ }
+};
+assertThrowsInstanceOf(function() {
+ Tuple.prototype.indexOf.call(undefined, undefined, fromIndex);
+}, TypeError);
+assertEq(stepFiveOccurs, false, 'stepFiveOccurs');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-2.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-2.js
new file mode 100644
index 0000000000..ca7591a49b
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-2.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Tuple.prototype.indexOf when fromIndex is string
+---*/
+
+var a = #[1, 2, 1, 2, 1, 2];
+
+assertEq(a.indexOf(2, "2"), 3, '"2" resolves to 2');
+assertEq(a.indexOf(2, "one"), 1, '"one" resolves to 0');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-exponent.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-exponent.js
new file mode 100644
index 0000000000..a544e56717
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-exponent.js
@@ -0,0 +1,16 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a string
+ containing an exponential number
+---*/
+
+var target = #[];
+
+assertEq(#[0, 1, target, 3, 4].indexOf(target, "3E0"), -1, '#[0, 1, target, 3, 4].indexOf(target, "3E0")');
+assertEq(#[0, 1, 2, target, 4].indexOf(target, "3E0"), 3, '#[0, 1, 2, target, 4].indexOf(target, "3E0")');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-hex.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-hex.js
new file mode 100644
index 0000000000..633a2688b3
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-hex.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.indexof
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a string
+ containing a hex number
+---*/
+
+var target = #[];
+
+assertEq(#[0, 1, target, 3, 4].indexOf(target, "0x0003"), -1, '#[0, 1, target, 3, 4].indexOf(target, "0x0003")');
+assertEq(#[0, 1, 2, target, 4].indexOf(target, "0x0003"), 3, '#[0, 1, 2, target, 4].indexOf(target, "0x0003")');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-leading-zeros.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-leading-zeros.js
new file mode 100644
index 0000000000..805516e4fa
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-leading-zeros.js
@@ -0,0 +1,16 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' which is a string
+ containing a number with leading zeros
+---*/
+
+var target = #[];
+
+assertEq(#[0, 1, target, 3, 4].indexOf(target, "0003.10"), -1, '#[0, 1, target, 3, 4].indexOf(target, "0003.10")');
+assertEq(#[0, 1, 2, target, 4].indexOf(target, "0003.10"), 3, '#[0, 1, 2, target, 4].indexOf(target, "0003.10")');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-neg-infinity.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-neg-infinity.js
new file mode 100644
index 0000000000..7595ab2bb5
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-neg-infinity.js
@@ -0,0 +1,13 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a string
+ containing -Infinity
+---*/
+
+assertEq(#[true].indexOf(true, "-Infinity"), 0, '#[true].indexOf(true, "-Infinity")');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-negative.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-negative.js
new file mode 100644
index 0000000000..1b1c330725
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string-negative.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a string
+ containing a negative number
+---*/
+
+assertEq(#[0, true, 2].indexOf(true, "-1"), -1, '#[0, true, 2].indexOf(true, "-1")');
+assertEq(#[0, 1, true].indexOf(true, "-1"), 2, '#[0, 1, true].indexOf(true, "-1")');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string.js
new file mode 100644
index 0000000000..1b1c330725
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-string.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a string
+ containing a negative number
+---*/
+
+assertEq(#[0, true, 2].indexOf(true, "-1"), -1, '#[0, true, 2].indexOf(true, "-1")');
+assertEq(#[0, 1, true].indexOf(true, "-1"), 2, '#[0, 1, true].indexOf(true, "-1")');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-trunc-2.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-trunc-2.js
new file mode 100644
index 0000000000..4d08a4700d
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-trunc-2.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.indexof
+description: >
+ Tuple.prototype.indexOf - 'fromIndex' is a negative non-integer,
+ verify truncation occurs in the proper direction
+---*/
+
+var target = #[];
+
+assertEq(#[0, target, 2].indexOf(target, -1.5), -1, '#[0, target, 2].indexOf(target, -1.5)');
+assertEq(#[0, 1, target].indexOf(target, -1.5), 2, '#[0, 1, target].indexOf(target, -1.5)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-trunc.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-trunc.js
new file mode 100644
index 0000000000..a9cbd3fa9c
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-trunc.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.indexof
+description: >
+ Tuple.prototype.indexOf - 'fromIndex' is a positive non-integer,
+ verify truncation occurs in the proper direction
+---*/
+
+var target = #[];
+
+assertEq(#[0, target, 2].indexOf(target, 2.5), -1, '#[0, target, 2].indexOf(target, 2.5)');
+assertEq(#[0, 1, target].indexOf(target, 2.5), 2, '#[0, 1, target].indexOf(target, 2.5)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-undefined.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-undefined.js
new file mode 100644
index 0000000000..054495a9d9
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-undefined.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Tuple.prototype.indexOf returns 0 if fromIndex is 'undefined'
+---*/
+
+var a = #[1, 2, 3];
+
+// undefined resolves to 0
+assertEq(a.indexOf(1, undefined), 0, 'a.indexOf(1,undefined)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-with-index.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-with-index.js
new file mode 100644
index 0000000000..75a5e5266f
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-with-index.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf match on the first element, a middle
+ element and the last element when 'fromIndex' is passed
+---*/
+
+assertEq(#[0, 1, 2, 3, 4].indexOf(0, 0), 0, '#[0, 1, 2, 3, 4].indexOf(0, 0)');
+assertEq(#[0, 1, 2, 3, 4].indexOf(2, 1), 2, '#[0, 1, 2, 3, 4].indexOf(2, 1)');
+assertEq(#[0, 1, 2, 3, 4].indexOf(2, 2), 2, '#[0, 1, 2, 3, 4].indexOf(2, 2)');
+assertEq(#[0, 1, 2, 3, 4].indexOf(4, 2), 4, '#[0, 1, 2, 3, 4].indexOf(4, 2)');
+assertEq(#[0, 1, 2, 3, 4].indexOf(4, 4), 4, '#[0, 1, 2, 3, 4].indexOf(4, 4)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-zero.js b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-zero.js
new file mode 100644
index 0000000000..0fa7d114e9
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/fromIndex-zero.js
@@ -0,0 +1,13 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - value of 'fromIndex' is a number (value
+ is +0)
+---*/
+
+assertEq(#[true].indexOf(true, +0), 0, '#[true].indexOf(true, +0)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/includes.js b/js/src/tests/non262/Tuple/prototype/indexOf/includes.js
new file mode 100644
index 0000000000..26ef2bfb03
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/includes.js
@@ -0,0 +1,18 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+/*
+8.2.3.7 Tuple.prototype.includes ( searchElement [ , fromIndex ] )
+Tuple.prototype.includes is a distinct function that implements the same algorithm as Array.prototype.includes as defined in 22.1.3.13 except that ? thisTupleValue(this value) is used instead of directly accessing the this value. The implementation of the algorithm may be optimized with the knowledge that the this value is an object that has a fixed length and whose integer-indexed properties are not sparse, do not change, and their access is not observable. However, such optimization must not introduce any observable changes in the specified behaviour of the algorithm.
+
+This function is not generic, since thisTupleValue(this value) can return an abrupt completion: in that case, that exception is thrown instead of evaluating the algorithm.
+*/
+
+/* Step 1 */
+/* includes() should throw on a non-Tuple */
+let method = Tuple.prototype.includes;
+assertEq(method.call(#[1,2,3,4,5,6], 2), true);
+assertEq(method.call(Object(#[1,2,3,4,5,6]), 2), true);
+assertThrowsInstanceOf(() => method.call("monkeys", 2), TypeError,
+ "value of TupleObject must be a Tuple");
+
+/* Not sure what else to test, since it just calls the array method */
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/length-internal.js b/js/src/tests/non262/Tuple/prototype/indexOf/length-internal.js
new file mode 100644
index 0000000000..a199884f00
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/length-internal.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+/* Tuples should have a length ownProperty that can't be overridden, which will
+ * be read by any built-in methods called on Tuples.
+ * This test is expected to fail until the spec change in
+ * https://github.com/tc39/proposal-record-tuple/issues/282 is implemented.
+ */
+
+/*
+t = #[1,2,3];
+Object.defineProperty(Tuple.prototype, "length", {value: 0});
+assertEq(t.includes(2), true);
+*/
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/length.js b/js/src/tests/non262/Tuple/prototype/indexOf/length.js
new file mode 100644
index 0000000000..46cd2b914b
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/length.js
@@ -0,0 +1,27 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+var desc = Object.getOwnPropertyDescriptor(Tuple.prototype.indexOf, "length");
+assertEq(desc.value, 1);
+assertEq(desc.writable, false);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, true);
+
+
+desc = Object.getOwnPropertyDescriptor(Tuple.prototype.indexOf, "name");
+assertEq(desc.value, "indexOf");
+assertEq(desc.writable, false);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, true);
+
+desc = Object.getOwnPropertyDescriptor(Tuple.prototype, "indexOf");
+assertEq(desc.writable, true);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, true);
+
+assertEq(isConstructor(Tuple.prototype.indexOf), false);
+
+assertThrowsInstanceOf(() => {
+ let t = #[1];
+ new t.indexOf();
+}, TypeError, '`let t = #[1]; new t.indexOf()` throws TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/undefined-throws-type-error.js b/js/src/tests/non262/Tuple/prototype/indexOf/undefined-throws-type-error.js
new file mode 100644
index 0000000000..da72398b79
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/undefined-throws-type-error.js
@@ -0,0 +1,18 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Tuple.prototype.indexOf applied to undefined throws a TypeError
+---*/
+
+
+assertThrowsInstanceOf(function() {
+ Tuple.prototype.indexOf.call(undefined);
+}, TypeError);
+
+assertThrowsInstanceOf(function() {
+ Tuple.prototype.indexOf.call(null);
+}, TypeError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/indexOf/uses-internal-length.js b/js/src/tests/non262/Tuple/prototype/indexOf/uses-internal-length.js
new file mode 100644
index 0000000000..8c8cc1beb4
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/indexOf/uses-internal-length.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.indexOf - 'length' is own data property that
+ overrides an inherited data property on an Tuple
+---*/
+
+var target = #[];
+
+Tuple.prototype.length = 0;
+
+assertEq(#[0, target].indexOf(target), 1, '#[0, target].indexOf(target)');
+
+reportCompare(0, 0);