Chromium Code Reviews| 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'; |