diff --git a/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-end.js b/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-end.js index cc6d196bb984b937be6d229aecf3964224e37952..3a8216d93412a404c171ea901aa71dde1a411d1e 100644 --- a/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-end.js +++ b/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-end.js @@ -25,6 +25,14 @@ assert( '[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]' ); +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity), + [1, 2, 3, 4, 5] + ), + '[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]' +); + assert( compareArray( [0, 1, 2, 3].copyWithin(0, -2, -10), @@ -33,6 +41,14 @@ assert( '[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]' ); +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity), + [1, 2, 3, 4, 5] + ), + '[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]' +); + assert( compareArray( [0, 1, 2, 3].copyWithin(0, -9, -10), @@ -41,6 +57,14 @@ assert( '[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]' ); +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity), + [1, 2, 3, 4, 5] + ), + '[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]' +); + assert( compareArray( [0, 1, 2, 3].copyWithin(-3, -2, -10), @@ -49,10 +73,26 @@ assert( '[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]' ); +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity), + [1, 2, 3, 4, 5] + ), + '[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]' +); + assert( compareArray( [0, 1, 2, 3].copyWithin(-7, -8, -9), [0, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]' -); \ No newline at end of file +); + +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity), + [1, 2, 3, 4, 5] + ), + '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]' +); diff --git a/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-start.js b/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-start.js index 278f31df045e5e8d0a7aa480544da32a3639d773..e6b3271b63c97bf0f2bb5852267923fa65641a2e 100644 --- a/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-start.js +++ b/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-start.js @@ -22,6 +22,14 @@ assert( '[0, 1, 2, 3].copyWithin(0, -10) -> [0, 1, 2, 3]' ); +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(0, -Infinity), + [1, 2, 3, 4, 5] + ), + '[1, 2, 3, 4, 5].copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]' +); + assert( compareArray( [0, 1, 2, 3, 4].copyWithin(2, -10), @@ -30,6 +38,15 @@ assert( '[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 0, 1, 2]' ); +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(2, -Infinity), + [1, 2, 1, 2, 3] + ), + '[1, 2, 3, 4, 5].copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]' +); + + assert( compareArray( [0, 1, 2, 3, 4].copyWithin(10, -10), @@ -38,6 +55,15 @@ assert( '[0, 1, 2, 3, 4].copyWithin(10, -10) -> [0, 1, 2, 3, 4]' ); +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(10, -Infinity), + [1, 2, 3, 4, 5] + ), + '[1, 2, 3, 4, 5].copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]' +); + + assert( compareArray( [0, 1, 2, 3].copyWithin(-9, -10), @@ -45,3 +71,11 @@ assert( ), '[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]' ); + +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(-9, -Infinity), + [1, 2, 3, 4, 5] + ), + '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]' +); diff --git a/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-target.js b/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-target.js index 3ada753cdebc2159a381a8cbeefca65335b9ba35..6a026a03f6e73c72a5efa509a73ed4df63bc24f3 100644 --- a/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-target.js +++ b/test/built-ins/Array/prototype/copyWithin/negative-out-of-bounds-target.js @@ -22,6 +22,14 @@ assert( '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]' ); +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(-Infinity, 0), + [1, 2, 3, 4, 5] + ), + '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]' +); + assert( compareArray( [0, 1, 2, 3, 4].copyWithin(-10, 2), @@ -29,3 +37,11 @@ assert( ), '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]' ); + +assert( + compareArray( + [1, 2, 3, 4, 5].copyWithin(-Infinity, 2), + [3, 4, 5, 4, 5] + ), + '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' +); diff --git a/test/built-ins/Array/prototype/copyWithin/non-negative-out-of-bounds-end.js b/test/built-ins/Array/prototype/copyWithin/non-negative-out-of-bounds-end.js index dc0fbb0bc68a9de08a7fe270e73c82309e10702c..3fb8291ce063848a579201aee5985de37a00f722 100644 --- a/test/built-ins/Array/prototype/copyWithin/non-negative-out-of-bounds-end.js +++ b/test/built-ins/Array/prototype/copyWithin/non-negative-out-of-bounds-end.js @@ -41,10 +41,26 @@ assert( '[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]' ); +assert( + compareArray( + [0, 1, 2, 3].copyWithin(0, 1, Infinity), + [1, 2, 3, 3] + ), + '[0, 1, 2, 3].copyWithin(0, 1, Infinity) -> [1, 2, 3, 3]' +); + assert( compareArray( [0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6), [0, 3, 4, 5, 4, 5] ), '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]' -); \ No newline at end of file +); + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(1, 3, Infinity), + [0, 3, 4, 5, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [0, 3, 4, 5, 4, 5]' +); diff --git a/test/built-ins/Array/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/Array/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js index 1099bf013d3a5ac74d479c3da85554e424670ccb..1d7fbaba72f9621b72e8585c51a9d5ac98add9af 100644 --- a/test/built-ins/Array/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js +++ b/test/built-ins/Array/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js @@ -31,26 +31,120 @@ assert( compareArray( [0, 1, 2, 3, 4, 5].copyWithin(6, 0), [0, 1, 2, 3, 4, 5] - ) + ), + '[0, 1, 2, 3, 4, 5].copyWithin(6, 0) => [0, 1, 2, 3, 4, 5]' +); + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(7, 0), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(6, 0) => [0, 1, 2, 3, 4, 5]' +); + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(Infinity, 0), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(Infinity, 0) => [0, 1, 2, 3, 4, 5]' +); + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(6, 2), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(6, 2) => [0, 1, 2, 3, 4, 5]' +); + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(7, 2), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(7, 2) => [0, 1, 2, 3, 4, 5]' +); + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(Infinity, 2), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(Infinity, 2) => [0, 1, 2, 3, 4, 5]' ); assert( compareArray( [0, 1, 2, 3, 4, 5].copyWithin(0, 6), [0, 1, 2, 3, 4, 5] - ) + ), + '[0, 1, 2, 3, 4, 5].copyWithin(0, 6) => [0, 1, 2, 3, 4, 5]' +); + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(0, 7), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(0, 7) => [0, 1, 2, 3, 4, 5]' +); + + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(0, Infinity), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(0, Infinity) => [0, 1, 2, 3, 4, 5]' +); + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(2, 6), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(2, 6) => [0, 1, 2, 3, 4, 5]' +); + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(1, 7), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(1, 7) => [0, 1, 2, 3, 4, 5]' +); + + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(3, Infinity), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(3, Infinity) => [0, 1, 2, 3, 4, 5]' ); assert( compareArray( [0, 1, 2, 3, 4, 5].copyWithin(6, 6), [0, 1, 2, 3, 4, 5] - ) + ), + '[0, 1, 2, 3, 4, 5].copyWithin(6, 6) => [0, 1, 2, 3, 4, 5]' ); assert( compareArray( [0, 1, 2, 3, 4, 5].copyWithin(10, 10), [0, 1, 2, 3, 4, 5] - ) + ), + '[0, 1, 2, 3, 4, 5].copyWithin(10, 10) => [0, 1, 2, 3, 4, 5]' +); + +assert( + compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(Infinity, Infinity), + [0, 1, 2, 3, 4, 5] + ), + '[0, 1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) => [0, 1, 2, 3, 4, 5]' );