diff options
Diffstat (limited to 'deps/v8/test/mjsunit/es6/classes-test-super.js')
-rw-r--r-- | deps/v8/test/mjsunit/es6/classes-test-super.js | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/es6/classes-test-super.js b/deps/v8/test/mjsunit/es6/classes-test-super.js new file mode 100644 index 0000000000..92f18729a8 --- /dev/null +++ b/deps/v8/test/mjsunit/es6/classes-test-super.js @@ -0,0 +1,120 @@ +// 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. + +// Flags: --allow-natives-syntax + +(function TestSuperInMethods() { + class B { + method() { + return 1; + } + get x() { + return 2; + } + } + class C extends B { + method() { + assertEquals(2, super.x); + return super.method(); + } + } + assertEquals(1, new C().method()); +})(); + + +(function TestSuperInGetter() { + class B { + method() { + return 1; + } + get x() { + return 2; + } + } + class C extends B { + get y() { + assertEquals(2, super.x); + return super.method(); + } + } + assertEquals(1, new C().y); +})(); + + +(function TestSuperInSetter() { + class B { + method() { + return 1; + } + get x() { + return 2; + } + } + class C extends B { + set y(v) { + assertEquals(3, v); + assertEquals(2, super.x); + assertEquals(1, super.method()); + } + } + assertEquals(3, new C().y = 3); +})(); + + +(function TestSuperInStaticMethods() { + class B { + static method() { + return 1; + } + static get x() { + return 2; + } + } + class C extends B { + static method() { + assertEquals(2, super.x); + return super.method(); + } + } + assertEquals(1, C.method()); +})(); + + +(function TestSuperInStaticGetter() { + class B { + static method() { + return 1; + } + static get x() { + return 2; + } + } + class C extends B { + static get x() { + assertEquals(2, super.x); + return super.method(); + } + } + assertEquals(1, C.x); +})(); + + +(function TestSuperInStaticSetter() { + class B { + static method() { + return 1; + } + static get x() { + return 2; + } + } + class C extends B { + static set x(v) { + assertEquals(3, v); + assertEquals(2, super.x); + assertEquals(1, super.method()); + } + } + assertEquals(3, C.x = 3); +})(); |