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

Unified Diff: test/mjsunit/primitive-keyed-access.js

Issue 1221303019: Fix keyed access of primitive objects in the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 5 years, 5 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 | « test/cctest/test-heap.cc ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/primitive-keyed-access.js
diff --git a/test/mjsunit/primitive-keyed-access.js b/test/mjsunit/primitive-keyed-access.js
new file mode 100644
index 0000000000000000000000000000000000000000..16bb6a07cad53fcf8ca835685f5b5f0a93fe1902
--- /dev/null
+++ b/test/mjsunit/primitive-keyed-access.js
@@ -0,0 +1,43 @@
+// Copyright 2015 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.
+
+Object.defineProperty(Number.prototype, "0",
+ { set: function(v) { set = v; }});
+Object.defineProperty(String.prototype, "0",
+ { set: function(v) { set = v; }});
+Object.defineProperty(String.prototype, "3",
+ { set: function(v) { set = v; }});
+
+var set;
+var n = 1;
+set = 0;
+n[0] = 100;
+assertEquals(100, set);
+var s = "bla";
+s[0] = 200;
+assertEquals(100, set);
+s[3] = 300;
+assertEquals(300, set);
+
+assertThrows(function(){"use strict"; var o = "123"; o[1] = 10; });
+assertThrows(function(){"use strict"; var o = ""; o[1] = 10; });
+assertThrows(function(){"use strict"; var o = 1; o[1] = 10; });
+
+assertThrows(function() {
+ "use strict";
+ var sym = Symbol('66');
+ sym.a = 0;
+});
+
+assertThrows(function() {
+ "use strict";
+ var sym = Symbol('66');
+ sym['a' + 'b'] = 0;
+});
+
+assertThrows(function() {
+ "use strict";
+ var sym = Symbol('66');
+ sym[62] = 0;
+});
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698