From be280ff3e4ba3116ccd1a908648fc8c25bb35eb3 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Wed, 28 Jun 2023 20:06:53 +1200 Subject: [PATCH] LibJS/Tests: Enable some now passing Array length tests Now that serenity is 64 bit only these tests no longer need to be skipped :^) --- .../LibJS/Tests/builtins/Array/Array.prototype.slice.js | 5 +---- .../LibJS/Tests/builtins/Array/Array.prototype.splice.js | 5 +---- .../LibJS/Tests/builtins/Array/Array.prototype.toSpliced.js | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.slice.js b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.slice.js index 62f495b917..3748299897 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.slice.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.slice.js @@ -38,10 +38,7 @@ test("basic functionality", () => { expect(slice).toEqual(["hello", "friends", "serenity", 1]); }); -// FIXME: These tests are currently skipped because an invalid array length in this case is 2**32 or above. -// The codebase currently uses size_t for lengths, which is currently the same as u32 when building for Serenity. -// This means these lengths wrap around to 0, making the test not work correctly. -test.skip("Invalid lengths", () => { +test("Invalid lengths", () => { var length = Math.pow(2, 32); var obj = { diff --git a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.splice.js b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.splice.js index 7be866f045..d342dbf0c6 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.splice.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.splice.js @@ -48,10 +48,7 @@ test("basic functionality", () => { expect(removed).toEqual(["foo", "bar", "baz"]); }); -// FIXME: These tests are currently skipped because an invalid array length in this case is 2**32 or above. -// The codebase currently uses size_t for lengths, which is currently the same as u32 when building for Serenity. -// This means these lengths wrap around to 0, making the test not work correctly. -test.skip("Invalid lengths", () => { +test("Invalid lengths", () => { var length = Math.pow(2, 32); var obj = { diff --git a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toSpliced.js b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toSpliced.js index ae2ebe4e84..3575e50148 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toSpliced.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toSpliced.js @@ -91,7 +91,7 @@ describe("errors", () => { }).toThrowWithMessage(TypeError, "ToObject on null or undefined"); }); - test.skip("maximum array size exceeded", () => { + test("maximum array size exceeded", () => { const a = { length: 2 ** 53 - 1 }; expect(() => { Array.prototype.toSpliced.call(a, 0, 0, "foo");