OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "package:expect/expect.dart"; | |
6 | |
7 // Tests static and instance fields initialization. | 5 // Tests static and instance fields initialization. |
8 class DefaultInitTest { | 6 class DefaultInitTest { |
9 static testMain() { | 7 static testMain() { |
10 Expect.equals(0, A.a); | 8 Expect.equals(0, A.a); |
11 Expect.equals(2, A.b); | 9 Expect.equals(2, A.b); |
12 Expect.equals(null, A.c); | 10 Expect.equals(null, A.c); |
13 | 11 |
14 A a1 = new A(42); | 12 A a1 = new A(42); |
15 Expect.equals(42, a1.d); | 13 Expect.equals(42, a1.d); |
16 Expect.equals(null, a1.e); | 14 Expect.equals(null, a1.e); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 55 } |
58 | 56 |
59 class D { | 57 class D { |
60 const D(): this.z = 3; | 58 const D(): this.z = 3; |
61 final int z; | 59 final int z; |
62 } | 60 } |
63 | 61 |
64 main() { | 62 main() { |
65 DefaultInitTest.testMain(); | 63 DefaultInitTest.testMain(); |
66 } | 64 } |
OLD | NEW |