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.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/Array.prototype-generic-functions.js b/Libraries/LibJS/Tests/Array.prototype-generic-functions.js
index 7ad699c33a..0fee4adcf3 100644
--- a/Libraries/LibJS/Tests/Array.prototype-generic-functions.js
+++ b/Libraries/LibJS/Tests/Array.prototype-generic-functions.js
@@ -52,6 +52,16 @@ try {
assert(Array.prototype.indexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", 3) === 4);
}
+ {
+ assert(Array.prototype.lastIndexOf.call({}) === -1);
+ assert(Array.prototype.lastIndexOf.call({ 0: undefined }) === -1);
+ assert(Array.prototype.lastIndexOf.call({ length: 1, 0: undefined }) === 0);
+ assert(Array.prototype.lastIndexOf.call({ length: 1, 2: "foo" }, "foo") === -1);
+ assert(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo" }, "foo") === 2);
+ assert(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo") === 4);
+ assert(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", -2) === 2);
+ }
+
const o = { length: 5, 0: "foo", 1: "bar", 3: "baz" };
{