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

Unified Diff: test/mjsunit/harmony/super.js

Issue 639243003: Support for super assignments in for..in. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: stray edit in ia32 removed Created 6 years, 2 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/x64/full-codegen-x64.cc ('K') | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/super.js
diff --git a/test/mjsunit/harmony/super.js b/test/mjsunit/harmony/super.js
index d1cba533d56f9c3dbee417572808f12b66f8021a..8939b5089f698dca509efee3eaa53deb0678a0ae 100644
--- a/test/mjsunit/harmony/super.js
+++ b/test/mjsunit/harmony/super.js
@@ -660,6 +660,55 @@
}());
+(function TestSetterInForIn() {
+ var setCalled = 0;
+ var getCalled = 0;
+ function Base() {}
+ Base.prototype = {
+ constructor: Base,
+ get x() {
+ getCalled++;
+ return 1;
+ },
+ set x(v) {
+ setCalled++;
+ this.x_.push(v);
+ },
+ };
+
+ function Derived() {
+ this.x_ = [];
+ }
+ Derived.prototype = {
+ __proto__: Base.prototype,
+ constructor: Derived,
+ };
+
+ Derived.prototype.testIter = function() {
+ setCalled = 0;
+ getCalled = 0;
+ for (super.x in [1,2,3]) {}
+ assertEquals(0, getCalled);
+ assertEquals(3, setCalled);
+ assertEquals(["0","1","2"], this.x_);
+ }.toMethod(Derived.prototype);
+
+ new Derived().testIter();
+
+ var x = 'x';
+ Derived.prototype.testIterKeyed = function() {
+ setCalled = 0;
+ getCalled = 0;
+ for (super[x] in [1,2,3]) {}
+ assertEquals(0, getCalled);
+ assertEquals(3, setCalled);
+ assertEquals(["0","1","2"], this.x_);
+ }.toMethod(Derived.prototype);
+
+ new Derived().testIterKeyed();
+}());
+
Igor Sheludko 2014/10/13 11:39:07 Does it make sense to test keyed access via object
Dmitry Lomov (no reviews) 2014/10/13 12:39:51 Done.
+
(function TestKeyedSetterCreatingOwnProperties() {
var ownReadOnly = 'ownReadOnly';
var ownReadonlyAccessor = 'ownReadonlyAccessor';
« src/x64/full-codegen-x64.cc ('K') | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698