Index: test/mjsunit/array-splice.js |
diff --git a/test/mjsunit/array-splice.js b/test/mjsunit/array-splice.js |
index be2b1064e6a12f49d00e713a42b126a4eb45c485..744e95454b97759183624a619d29babbc7864a3b 100644 |
--- a/test/mjsunit/array-splice.js |
+++ b/test/mjsunit/array-splice.js |
@@ -116,16 +116,41 @@ |
assertEquals([1, 2, 3, 4, 5, 6, 7], spliced); |
array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(-1e100); |
+ assertEquals([], array); |
+ assertEquals([1, 2, 3, 4, 5, 6, 7], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
spliced = array.splice(-3); |
assertEquals([1, 2, 3, 4], array); |
assertEquals([5, 6, 7], spliced); |
array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(-3.999999); |
+ assertEquals([1, 2, 3, 4], array); |
+ assertEquals([5, 6, 7], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(-3.000001); |
+ assertEquals([1, 2, 3, 4], array); |
+ assertEquals([5, 6, 7], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
spliced = array.splice(4); |
assertEquals([1, 2, 3, 4], array); |
assertEquals([5, 6, 7], spliced); |
array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(4.999999); |
+ assertEquals([1, 2, 3, 4], array); |
+ assertEquals([5, 6, 7], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(4.000001); |
+ assertEquals([1, 2, 3, 4], array); |
+ assertEquals([5, 6, 7], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
spliced = array.splice(6); |
assertEquals([1, 2, 3, 4, 5, 6], array); |
assertEquals([7], spliced); |
@@ -146,21 +171,51 @@ |
assertEquals([], spliced); |
array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(1e100); |
+ assertEquals([1, 2, 3, 4, 5, 6, 7], array); |
+ assertEquals([], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
spliced = array.splice(0, -100); |
assertEquals([1, 2, 3, 4, 5, 6, 7], array); |
assertEquals([], spliced); |
array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(0, -1e100); |
+ assertEquals([1, 2, 3, 4, 5, 6, 7], array); |
+ assertEquals([], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
spliced = array.splice(0, -3); |
assertEquals([1, 2, 3, 4, 5, 6, 7], array); |
assertEquals([], spliced); |
array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(0, -3.999999); |
+ assertEquals([1, 2, 3, 4, 5, 6, 7], array); |
+ assertEquals([], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(0, -3.000001); |
+ assertEquals([1, 2, 3, 4, 5, 6, 7], array); |
+ assertEquals([], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
spliced = array.splice(0, 4); |
assertEquals([5, 6, 7], array); |
assertEquals([1, 2, 3, 4], spliced); |
array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(0, 4.999999); |
+ assertEquals([5, 6, 7], array); |
+ assertEquals([1, 2, 3, 4], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(0, 4.000001); |
+ assertEquals([5, 6, 7], array); |
+ assertEquals([1, 2, 3, 4], spliced); |
+ |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
spliced = array.splice(0, 6); |
assertEquals([7], array); |
assertEquals([1, 2, 3, 4, 5, 6], spliced); |
@@ -180,6 +235,11 @@ |
assertEquals([], array); |
assertEquals([1, 2, 3, 4, 5, 6, 7], spliced); |
+ array = [1, 2, 3, 4, 5, 6, 7]; |
+ spliced = array.splice(0, 1e100); |
+ assertEquals([], array); |
+ assertEquals([1, 2, 3, 4, 5, 6, 7], spliced); |
+ |
// Some exotic cases. |
obj = { toString: function() { throw 'Exception'; } }; |