Skip to content

Commit

Permalink
add super getter / setter runtime_test case
Browse files Browse the repository at this point in the history
  • Loading branch information
brad4d committed Jun 8, 2017
1 parent c7c09dd commit 4702f7a
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,36 @@ function testSubclassGetter() {
assertEquals(1, s.counter);
}

class SuffixAndCount extends Sub {
constructor() {
super();
this.foo_ = 'initial-value';
}

/** @return {string} */
get foo() {
return super.foo + '-' + this.foo_;
}

/** @param {string} val */
set foo(val) {
super.foo = val;
this.foo_ = val;
}
}

function testInvokeSuperGetterAndSetter() {
let s1 = new SuffixAndCount();
let s2 = new SuffixAndCount();

s1.foo = 'modified'
assertEquals('sub-modified', s1.foo);
assertEquals(1, s1.counter);
// s2 should not have been affected
assertEquals('sub-initial-value', s2.foo);
assertEquals(0, s2.counter);
}

var Multiple = class {
get foo() {
return 'foo';
Expand Down

0 comments on commit 4702f7a

Please sign in to comment.