Index: test/mjsunit/array-unshift.js |
diff --git a/test/mjsunit/array-unshift.js b/test/mjsunit/array-unshift.js |
index 8b357963d9a7149f45ca8918967bb3e66a84999c..06a78a7d9ee8902910a5d7118d045629716b0c1c 100644 |
--- a/test/mjsunit/array-unshift.js |
+++ b/test/mjsunit/array-unshift.js |
@@ -114,3 +114,19 @@ |
assertTrue(delete Array.prototype[5]); |
assertTrue(delete Array.prototype[7]); |
})(); |
+ |
+// Check the behaviour when approaching maximal values for length. |
+(function() { |
+ for (var i = 0; i < 7; i++) { |
+ try { |
+ new Array((1 << 32) - 3).unshift(1, 2, 3, 4, 5); |
+ throw 'Should have thrown RangeError'; |
+ } catch (e) { |
+ assertTrue(e instanceof RangeError); |
+ } |
+ |
+ // Check smi boundary |
+ var bigNum = (1 << 30) - 3; |
+ assertEquals(bigNum + 7, new Array(bigNum).unshift(1, 2, 3, 4, 5, 6, 7)); |
+ } |
+})(); |