Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: test/mjsunit/array-splice.js

Issue 1549016: [Not for commit] Make Array.splice change receiver's FixedArray when significant part is cut. (Closed)
Patch Set: Additional tests for splice Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/builtins.cc ('K') | « src/builtins.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/array-splice.js
diff --git a/test/mjsunit/array-splice.js b/test/mjsunit/array-splice.js
index 887097db61c151d82a41ffb11f9b17395954130b..cd851336414d4d707fbc026431b03dc88ea107e1 100644
--- a/test/mjsunit/array-splice.js
+++ b/test/mjsunit/array-splice.js
@@ -218,6 +218,40 @@
})();
+// Check behavior on significant part spliced.
+(function() {
+ var array, spliced;
+ for (var i = 0; i < 7; i++) {
+ array = [1, 2, 3, 4, 5, 6, 7];
+ spliced = array.splice(-100, 100, 9);
+ assertEquals([9], array);
+ assertEquals([1, 2, 3, 4, 5, 6, 7], spliced);
+ }
+
+ for (var i = 0; i < 7; i++) {
+ array = [1, 2, 3, 4, 5, 6, 7];
+ spliced = array.splice(0, 6, 9);
+ assertEquals([9, 7], array);
+ assertEquals([1, 2, 3, 4, 5, 6], spliced);
+ }
+
+ for (var i = 0; i < 7; i++) {
+ array = [1, 2, 3, 4, 5, 6, 7];
+ spliced = array.splice(1, 5, 9);
+ assertEquals([1, 9, 7], array);
+ assertEquals([2, 3, 4, 5, 6], spliced);
+ }
+
+ for (var i = 0; i < 7; i++) {
+ array = [1, 2, 3, 4, 5, 6, 7];
+ spliced = array.splice(1, 100, 9);
+ assertEquals([1, 9], array);
+ assertEquals([2, 3, 4, 5, 6, 7], spliced);
+ }
+
+})();
+
+
// Nasty: modify the array in ToInteger.
(function() {
var array = [];
« src/builtins.cc ('K') | « src/builtins.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698