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

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

Issue 232873002: Partially fix semantics of Array.push() (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add missing test case Created 6 years, 8 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
« no previous file with comments | « src/string.js ('k') | test/mjsunit/array-push3.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/array-push2.js
diff --git a/test/mjsunit/array-push2.js b/test/mjsunit/array-push2.js
new file mode 100644
index 0000000000000000000000000000000000000000..fe4be4eb3e852bb0d7e6bc0f3c99fa2dea45870f
--- /dev/null
+++ b/test/mjsunit/array-push2.js
@@ -0,0 +1,21 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var array = [];
+var v = 0;
+
+Object.defineProperty(Array.prototype, "0", {
+ get: function() { return "get " + v; },
+ set: function(value) { v += value; }
+});
+
+array[0] = 10;
+assertEquals(0, array.length);
+assertEquals(10, v);
+assertEquals("get 10", array[0]);
+
+array.push(100);
+assertEquals(1, array.length);
+assertEquals(110, v);
+assertEquals("get 110", array[0]);
« no previous file with comments | « src/string.js ('k') | test/mjsunit/array-push3.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698