mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:47:35 +00:00
LibJS: Make Array.prototype.reverse generic
This commit is contained in:
parent
516f6240e8
commit
2ef9df989f
2 changed files with 64 additions and 13 deletions
|
@ -188,4 +188,19 @@ describe("ability to work with generic non-array objects", () => {
|
|||
);
|
||||
expect(visited).toEqual(["baz", "bar", "foo"]);
|
||||
});
|
||||
|
||||
test("reverse", () => {
|
||||
expect(Array.prototype.reverse.call(o)).toEqual({
|
||||
length: 5,
|
||||
4: "foo",
|
||||
3: "bar",
|
||||
1: "baz",
|
||||
});
|
||||
expect(Array.prototype.reverse.call({})).toEqual({});
|
||||
expect(Array.prototype.reverse.call({ length: 10 })).toEqual({ length: 10 });
|
||||
expect(Array.prototype.reverse.call({ length: 1, 0: "foo" })).toEqual({
|
||||
length: 1,
|
||||
0: "foo",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue