summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Tests')
-rw-r--r--Libraries/LibJS/Tests/Array.prototype-generic-functions.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/Array.prototype-generic-functions.js b/Libraries/LibJS/Tests/Array.prototype-generic-functions.js
index 702d575a4b..7ad699c33a 100644
--- a/Libraries/LibJS/Tests/Array.prototype-generic-functions.js
+++ b/Libraries/LibJS/Tests/Array.prototype-generic-functions.js
@@ -43,6 +43,15 @@ try {
assert(Array.prototype.toString.call({ join: () => "foo" }) === "foo");
}
+ {
+ assert(Array.prototype.indexOf.call({}) === -1);
+ assert(Array.prototype.indexOf.call({ 0: undefined }) === -1);
+ assert(Array.prototype.indexOf.call({ length: 1, 0: undefined }) === 0);
+ assert(Array.prototype.indexOf.call({ length: 1, 2: "foo" }, "foo") === -1);
+ assert(Array.prototype.indexOf.call({ length: 5, 2: "foo" }, "foo") === 2);
+ assert(Array.prototype.indexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", 3) === 4);
+ }
+
const o = { length: 5, 0: "foo", 1: "bar", 3: "baz" };
{