mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
LibJS: Make Array.prototype.indexOf() generic
This commit is contained in:
parent
174ac5d348
commit
9b9b6a4cff
2 changed files with 22 additions and 16 deletions
|
@ -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" };
|
||||
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue