Chromium Code Reviews| Index: test/mjsunit/harmony/classes-experimental.js |
| diff --git a/test/mjsunit/harmony/classes-experimental.js b/test/mjsunit/harmony/classes-experimental.js |
| index 73944b182c607d82801e224c44d9e4c8bb288cf6..1a0f872e79e22eba318ba6a73d5c1605d01b80a7 100644 |
| --- a/test/mjsunit/harmony/classes-experimental.js |
| +++ b/test/mjsunit/harmony/classes-experimental.js |
| @@ -7,29 +7,34 @@ |
| 'use strict'; |
| class Base { |
| - constructor() { |
| + constructor(a, b) { |
| let o = new Object(); |
| - o.prp = 1; |
| + o.prp = a + b; |
| return o; |
| } |
| } |
| class Subclass extends Base { |
| - constructor() { |
| + constructor(a, b) { |
| + var exn; |
| try { |
| this.prp1 = 3; |
| } catch (e) { |
| - // TODO(dslomov): actually test the exception once TDZ is implemented. |
| + exn = e; |
| } |
| - super(); |
| - assertSame(1, this.prp); |
| + assertTrue(exn instanceof ReferenceError); |
| + super(a, b); |
| + assertSame(a + b, this.prp); |
| assertSame(undefined, this.prp1); |
| assertFalse(this.hasOwnProperty("prp1")); |
| return this; |
|
arv (Not doing code reviews)
2015/01/24 16:19:09
Can you add a few more test cases?
1. A construct
Dmitry Lomov (no reviews)
2015/01/26 23:34:04
This is not implemented yet - coming next
|
| } |
| } |
| -let s = new Subclass(); |
| +let b = new Base(1, 2); |
| +assertSame(3, b.prp); |
| + |
| +let s = new Subclass(2, -1); |
| assertSame(1, s.prp); |
| assertSame(undefined, s.prp1); |
| assertFalse(s.hasOwnProperty("prp1")); |