summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Tuple/prototype/includes
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/includes
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 '')
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/fromIndex-equal-or-greater-length-returns-false.js13
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/fromIndex-infinity.js23
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/fromIndex-minus-zero.js24
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/includes.js18
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/length-internal.js14
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/length-zero-returns-false.js23
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/length.js27
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/name.js17
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/no-arg.js12
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/not-a-constructor.js20
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/prop-desc.js14
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/return-abrupt-get-length.js27
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js15
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tointeger-fromindex.js21
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tonumber-length-symbol.js15
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/samevaluezero.js21
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/search-found-returns-true.js28
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/search-not-found-returns-false.js26
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/this-is-not-tuple.js17
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/tointeger-fromindex.js40
-rw-r--r--js/src/tests/non262/Tuple/prototype/includes/using-fromindex.js38
21 files changed, 453 insertions, 0 deletions
diff --git a/js/src/tests/non262/Tuple/prototype/includes/fromIndex-equal-or-greater-length-returns-false.js b/js/src/tests/non262/Tuple/prototype/includes/fromIndex-equal-or-greater-length-returns-false.js
new file mode 100644
index 0000000000..6108e38cbc
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/fromIndex-equal-or-greater-length-returns-false.js
@@ -0,0 +1,13 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Return false if fromIndex >= TupleLength
+---*/
+
+var sample = #[7, 7, 7, 7];
+assertEq(sample.includes(7, 4), false, "length");
+assertEq(sample.includes(7, 5), false, "length + 1");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/fromIndex-infinity.js b/js/src/tests/non262/Tuple/prototype/includes/fromIndex-infinity.js
new file mode 100644
index 0000000000..3ed0c3b43c
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/fromIndex-infinity.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.includes
+description: handle Infinity values for fromIndex
+---*/
+
+var sample = #[42, 43, 43, 41];
+
+assertEq(
+ sample.includes(43, Infinity),
+ false,
+ "includes(43, Infinity)"
+);
+assertEq(
+ sample.includes(43, -Infinity),
+ true,
+ "includes(43, -Infinity)"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/fromIndex-minus-zero.js b/js/src/tests/non262/Tuple/prototype/includes/fromIndex-minus-zero.js
new file mode 100644
index 0000000000..23ebaf8346
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/fromIndex-minus-zero.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.includes
+description: -0 fromIndex becomes 0
+info: |
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 5. If n ≥ 0, then
+ a. Let k be n.
+ ...
+ 7. Repeat, while k < len
+ ...
+---*/
+
+var sample = [42, 43];
+assertEq(sample.includes(42, -0), true, "-0 [0]");
+assertEq(sample.includes(43, -0), true, "-0 [1]");
+assertEq(sample.includes(44, -0), false, "-0 [2]");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/includes.js b/js/src/tests/non262/Tuple/prototype/includes/includes.js
new file mode 100644
index 0000000000..26ef2bfb03
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/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/includes/length-internal.js b/js/src/tests/non262/Tuple/prototype/includes/length-internal.js
new file mode 100644
index 0000000000..a199884f00
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/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/includes/length-zero-returns-false.js b/js/src/tests/non262/Tuple/prototype/includes/length-zero-returns-false.js
new file mode 100644
index 0000000000..b72397d8f3
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/length-zero-returns-false.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Returns false if length is 0
+ ...
+---*/
+
+var calls = 0;
+var fromIndex = {
+ valueOf: function() {
+ calls++;
+ }
+};
+
+var sample = #[];
+assertEq(sample.includes(0), false, "returns false");
+assertEq(sample.includes(), false, "returns false - no arg");
+assertEq(sample.includes(0, fromIndex), false, "using fromIndex");
+assertEq(calls, 0, "length is checked before ToInteger(fromIndex)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/length.js b/js/src/tests/non262/Tuple/prototype/includes/length.js
new file mode 100644
index 0000000000..b8a60b837c
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/length.js
@@ -0,0 +1,27 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+var desc = Object.getOwnPropertyDescriptor(Tuple.prototype.includes, "length");
+assertEq(desc.value, 1);
+assertEq(desc.writable, false);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, true);
+
+
+desc = Object.getOwnPropertyDescriptor(Tuple.prototype.includes, "name");
+assertEq(desc.value, "includes");
+assertEq(desc.writable, false);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, true);
+
+desc = Object.getOwnPropertyDescriptor(Tuple.prototype, "includes");
+assertEq(desc.writable, true);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, true);
+
+assertEq(isConstructor(Tuple.prototype.includes), false);
+
+assertThrowsInstanceOf(() => {
+ let t = #[1];
+ new t.includes();
+}, TypeError, '`let t = #[1]; new t.includes()` throws TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/name.js b/js/src/tests/non262/Tuple/prototype/includes/name.js
new file mode 100644
index 0000000000..df6537a3b4
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/name.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.includes.name is "includes".
+---*/
+
+assertEq(Tuple.prototype.includes.name, "includes");
+var desc = Object.getOwnPropertyDescriptor(Tuple.prototype.includes, "name");
+
+assertEq(desc.writable, false);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/no-arg.js b/js/src/tests/non262/Tuple/prototype/includes/no-arg.js
new file mode 100644
index 0000000000..83fee6722c
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/no-arg.js
@@ -0,0 +1,12 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: no argument searches for a undefined value
+---*/
+
+assertEq(#[0].includes(), false, "#[0].includes()");
+assertEq(#[undefined].includes(), true, "#[undefined].includes()");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/not-a-constructor.js b/js/src/tests/non262/Tuple/prototype/includes/not-a-constructor.js
new file mode 100644
index 0000000000..e60846e70a
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/not-a-constructor.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Tuple.prototype.includes does not implement [[Construct]], is not new-able
+---*/
+
+assertEq(
+ isConstructor(Tuple.prototype.includes),
+ false,
+ 'isConstructor(Tuple.prototype.includes) must return false'
+);
+
+assertThrowsInstanceOf(() => new Tuple.prototype.includes(1),
+ TypeError, '`new Tuple.prototype.includes(1)` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/prop-desc.js b/js/src/tests/non262/Tuple/prototype/includes/prop-desc.js
new file mode 100644
index 0000000000..4dcd03d64c
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/prop-desc.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ "includes" property of Tuple.prototype
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(Tuple.prototype, "includes");
+assertEq(desc.writable, true);
+assertEq(desc.enumerable, false);
+assertEq(desc.configurable, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-get-length.js b/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-get-length.js
new file mode 100644
index 0000000000..169a4318d8
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-get-length.js
@@ -0,0 +1,27 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.includes
+description: Return abrupt from Get(O, "length")
+info: |
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+---*/
+
+var obj = {};
+
+Object.defineProperty(obj, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assertThrowsInstanceOf(() => #[].includes.call(obj, 7), TypeError,
+ "value of TupleObject must be a tuple");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js b/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js
new file mode 100644
index 0000000000..9f6a0f5938
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js
@@ -0,0 +1,15 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Return abrupt from ToInteger(fromIndex) - using symbol
+---*/
+
+var fromIndex = Symbol("1");
+
+var sample = #[7];
+
+assertThrowsInstanceOf(() => sample.includes(7, fromIndex), TypeError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tointeger-fromindex.js b/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tointeger-fromindex.js
new file mode 100644
index 0000000000..2d8ec0ee87
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tointeger-fromindex.js
@@ -0,0 +1,21 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Return abrupt from ToInteger(fromIndex)
+---*/
+
+function TestError() {};
+
+var fromIndex = {
+ valueOf: function() {
+ throw new TestError();
+ }
+};
+
+var sample = #[7];
+
+assertThrowsInstanceOf(() => sample.includes(7, fromIndex), TestError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tonumber-length-symbol.js b/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tonumber-length-symbol.js
new file mode 100644
index 0000000000..f94fde9772
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/return-abrupt-tonumber-length-symbol.js
@@ -0,0 +1,15 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Return abrupt from ToNumber(symbol "length")
+---*/
+
+var obj = {
+ length: Symbol("1")
+};
+
+assertThrowsInstanceOf(() => #[].includes.call(obj, 7), TypeError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/samevaluezero.js b/js/src/tests/non262/Tuple/prototype/includes/samevaluezero.js
new file mode 100644
index 0000000000..c8dbe08c14
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/samevaluezero.js
@@ -0,0 +1,21 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: search element is compared using SameValueZero
+---*/
+
+var sample = #[42, 0, 1, NaN];
+assertEq(sample.includes("42"), false);
+assertEq(sample.includes([42]), false);
+assertEq(sample.includes(#[42]), false);
+assertEq(sample.includes(42.0), true);
+assertEq(sample.includes(-0), true);
+assertEq(sample.includes(true), false);
+assertEq(sample.includes(false), false);
+assertEq(sample.includes(null), false);
+assertEq(sample.includes(""), false);
+assertEq(sample.includes(NaN), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/search-found-returns-true.js b/js/src/tests/non262/Tuple/prototype/includes/search-found-returns-true.js
new file mode 100644
index 0000000000..0084583591
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/search-found-returns-true.js
@@ -0,0 +1,28 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: returns true for found index
+---*/
+
+var symbol = Symbol("1");
+var tuple = #[];
+var record = #{};
+
+var sample = #[42, "test262", null, undefined, true, false, 0, -1, "", symbol, tuple, record];
+
+assertEq(sample.includes(42), true, "42");
+assertEq(sample.includes("test262"), true, "'test262'");
+assertEq(sample.includes(null), true, "null");
+assertEq(sample.includes(undefined), true, "undefined");
+assertEq(sample.includes(true), true, "true");
+assertEq(sample.includes(false), true, "false");
+assertEq(sample.includes(0), true, "0");
+assertEq(sample.includes(-1), true, "-1");
+assertEq(sample.includes(""), true, "the empty string");
+assertEq(sample.includes(symbol), true, "symbol");
+assertEq(sample.includes(tuple), true, "tuple");
+assertEq(sample.includes(record), true, "record");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/search-not-found-returns-false.js b/js/src/tests/non262/Tuple/prototype/includes/search-not-found-returns-false.js
new file mode 100644
index 0000000000..0e1889099f
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/search-not-found-returns-false.js
@@ -0,0 +1,26 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: returns false if the element is not found
+---*/
+
+assertEq(#[42].includes(43), false, "43");
+
+assertEq(#["test262"].includes("test"), false, "string");
+
+assertEq(#[0, "test262", undefined].includes(""), false, "the empty string");
+
+assertEq(#["true", false].includes(true), false, "true");
+assertEq(#["", true].includes(false), false, "false");
+
+assertEq(#[undefined, false, 0, 1].includes(null), false, "null");
+assertEq(#[null].includes(undefined), false, "undefined");
+
+assertEq(#[Symbol("1")].includes(Symbol("1")), false, "symbol");
+
+var sample = #[42];
+assertEq(sample.includes(sample), false, "this");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/this-is-not-tuple.js b/js/src/tests/non262/Tuple/prototype/includes/this-is-not-tuple.js
new file mode 100644
index 0000000000..00679f2a73
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/this-is-not-tuple.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Throws a TypeError exception when `this` cannot be coerced to Tuple
+---*/
+
+var includes = Tuple.prototype.includes;
+
+assertThrowsInstanceOf(() => includes.call(undefined, 42), TypeError,
+ "this is undefined");
+
+assertThrowsInstanceOf(() => includes.call(null, 42), TypeError,
+ "this is null");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/tointeger-fromindex.js b/js/src/tests/non262/Tuple/prototype/includes/tointeger-fromindex.js
new file mode 100644
index 0000000000..608dbbf732
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/tointeger-fromindex.js
@@ -0,0 +1,40 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: get the integer value from fromIndex
+*/
+
+var obj = {
+ valueOf: function() {
+ return 1;
+ }
+};
+
+var sample = #[42, 43];
+assertEq(sample.includes(42, "1"), false, "string [0]");
+assertEq(sample.includes(43, "1"), true, "string [1]");
+
+assertEq(sample.includes(42, true), false, "true [0]");
+assertEq(sample.includes(43, true), true, "true [1]");
+
+assertEq(sample.includes(42, false), true, "false [0]");
+assertEq(sample.includes(43, false), true, "false [1]");
+
+assertEq(sample.includes(42, NaN), true, "NaN [0]");
+assertEq(sample.includes(43, NaN), true, "NaN [1]");
+
+assertEq(sample.includes(42, null), true, "null [0]");
+assertEq(sample.includes(43, null), true, "null [1]");
+
+assertEq(sample.includes(42, undefined), true, "undefined [0]");
+assertEq(sample.includes(43, undefined), true, "undefined [1]");
+
+assertEq(sample.includes(42, null), true, "null [0]");
+assertEq(sample.includes(43, null), true, "null [1]");
+
+assertEq(sample.includes(42, obj), false, "object [0]");
+assertEq(sample.includes(43, obj), true, "object [1]");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/non262/Tuple/prototype/includes/using-fromindex.js b/js/src/tests/non262/Tuple/prototype/includes/using-fromindex.js
new file mode 100644
index 0000000000..7dbcc00c20
--- /dev/null
+++ b/js/src/tests/non262/Tuple/prototype/includes/using-fromindex.js
@@ -0,0 +1,38 @@
+// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 22.1.3.11 Tuple.prototype.includes ( searchElement [ , fromIndex ] )
+---*/
+
+var sample = #["a", "b", "c"];
+assertEq(sample.includes("a", 0), true, "includes('a', 0)");
+assertEq(sample.includes("a", 1), false, "includes('a', 1)");
+assertEq(sample.includes("a", 2), false, "includes('a', 2)");
+
+assertEq(sample.includes("b", 0), true, "includes('b', 0)");
+assertEq(sample.includes("b", 1), true, "includes('b', 1)");
+assertEq(sample.includes("b", 2), false, "includes('b', 2)");
+
+assertEq(sample.includes("c", 0), true, "includes('c', 0)");
+assertEq(sample.includes("c", 1), true, "includes('c', 1)");
+assertEq(sample.includes("c", 2), true, "includes('c', 2)");
+
+assertEq(sample.includes("a", -1), false, "includes('a', -1)");
+assertEq(sample.includes("a", -2), false, "includes('a', -2)");
+assertEq(sample.includes("a", -3), true, "includes('a', -3)");
+assertEq(sample.includes("a", -4), true, "includes('a', -4)");
+
+assertEq(sample.includes("b", -1), false, "includes('b', -1)");
+assertEq(sample.includes("b", -2), true, "includes('b', -2)");
+assertEq(sample.includes("b", -3), true, "includes('b', -3)");
+assertEq(sample.includes("b", -4), true, "includes('b', -4)");
+
+assertEq(sample.includes("c", -1), true, "includes('c', -1)");
+assertEq(sample.includes("c", -2), true, "includes('c', -2)");
+assertEq(sample.includes("c", -3), true, "includes('c', -3)");
+assertEq(sample.includes("c", -4), true, "includes('c', -4)");
+
+reportCompare(0, 0);