Index: test/mjsunit/harmony/classes.js |
diff --git a/test/mjsunit/harmony/classes.js b/test/mjsunit/harmony/classes.js |
index 3a22fd9b5427dcf74873f541744fcd65c42a7978..c44c2cdcb9a05ab229caec8949f6f71f4685594f 100644 |
--- a/test/mjsunit/harmony/classes.js |
+++ b/test/mjsunit/harmony/classes.js |
@@ -174,6 +174,7 @@ function assertMethodDescriptor(object, name) { |
assertEquals('function', typeof descr.value); |
} |
+ |
function assertGetterDescriptor(object, name) { |
var descr = Object.getOwnPropertyDescriptor(object, name); |
assertTrue(descr.configurable); |
@@ -387,6 +388,56 @@ function assertAccessorDescriptor(object, name) { |
assertEquals(2, C.staticM()); |
})(); |
+ |
+(function TestConstructableButNoPrototype() { |
+ var Base = function() {}.bind(); |
+ assertThrows(function() { |
+ class C extends Base {} |
+ }, TypeError); |
+})(); |
+ |
+ |
+(function TestPrototypeGetter() { |
+ var calls = 0; |
+ var Base = function() {}.bind(); |
+ Object.defineProperty(Base, 'prototype', { |
+ get: function() { |
+ calls++; |
+ return null; |
+ }, |
+ configurable: true |
+ }); |
+ class C extends Base {} |
+ assertEquals(1, calls); |
+ |
+ calls = 0; |
+ Object.defineProperty(Base, 'prototype', { |
+ get: function() { |
+ calls++; |
+ return 42; |
+ }, |
+ configurable: true |
+ }); |
+ assertThrows(function() { |
+ class C extends Base {} |
+ }, TypeError); |
+ assertEquals(1, calls); |
+})(); |
+ |
+ |
+(function TestPrototypeSetter() { |
+ var Base = function() {}.bind(); |
+ Object.defineProperty(Base, 'prototype', { |
+ set: function() { |
+ assertUnreachable(); |
+ } |
+ }); |
+ assertThrows(function() { |
+ class C extends Base {} |
+ }, TypeError); |
+})(); |
+ |
+ |
/* TODO(arv): Implement |
(function TestNameBindingInConstructor() { |
class C { |