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..5a3c3e5558319941e0098dabdc712ebfd1be0e93 100644 |
| --- a/test/mjsunit/harmony/classes-experimental.js |
| +++ b/test/mjsunit/harmony/classes-experimental.js |
| @@ -7,29 +7,51 @@ |
| '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; |
| } |
| } |
| -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")); |
| + |
| +class Subclass2 extends Base { |
| + constructor() { |
| + super(1,2); |
| + |
| + let called = false; |
| + function tmp() { called = true; return 3; } |
| + var exn = null; |
|
arv (Not doing code reviews)
2015/01/27 21:08:27
any reason why you are using var here and let abov
Dmitry Lomov (no reviews)
2015/02/03 15:47:04
Done.
|
| + try { |
| + super(tmp(),4); |
| + } catch(e) { exn = e; } |
| + assertTrue(exn !== null); |
| + assertFalse(called); |
| + } |
| +} |
| + |
| +new Subclass2(); |