Index: test/mjsunit/es6/classes-subclass-builtins.js |
diff --git a/test/mjsunit/es6/classes-subclass-builtins.js b/test/mjsunit/es6/classes-subclass-builtins.js |
index 7e0958baf14b57c743cf3f74c10f21b532f7a5d8..1dd93e77f37660907f6a95ab749569ed500d8398 100644 |
--- a/test/mjsunit/es6/classes-subclass-builtins.js |
+++ b/test/mjsunit/es6/classes-subclass-builtins.js |
@@ -547,6 +547,46 @@ function TestMapSetSubclassing(container, is_map) { |
(function() { |
+ class A extends Promise { |
+ constructor(...args) { |
+ assertTrue(%IsConstructCall()); |
+ super(...args); |
+ this.a = 42; |
+ this.d = 4.2; |
+ this.o = {foo:153}; |
+ } |
+ } |
+ |
+ var o = new A(function(resolve, reject) { |
+ resolve("ok"); |
+ }); |
+ assertTrue(o instanceof Object); |
+ assertTrue(o instanceof Promise); |
+ assertTrue(o instanceof A); |
+ assertEquals("object", typeof o); |
+ checkPrototypeChain(o, [A, Promise, Object]); |
+ assertEquals(42, o.a); |
+ assertEquals(4.2, o.d); |
+ assertEquals(153, o.o.foo); |
+ o.then( |
+ function(val) { assertEquals("ok", val); }, |
+ function(reason) { assertUnreachable(); }) |
+ .catch(function(reason) { %AbortJS("catch handler called: " + reason); }); |
+ |
+ var o1 = new A(function(resolve, reject) { |
+ reject("fail"); |
+ }); |
+ o1.then( |
+ function(val) { assertUnreachable(); }, |
+ function(reason) { assertEquals("fail", reason); }) |
+ .catch(function(reason) { %AbortJS("catch handler called: " + reason); }); |
+ assertTrue(%HaveSameMap(o, o1)); |
+ |
+ gc(); |
+})(); |
+ |
+ |
+(function() { |
class A extends Boolean { |
constructor() { |
assertTrue(%IsConstructCall()); |