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 // Dart test program for constructors and initializers. | 4 // Dart test program for constructors and initializers. |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 // Expect the initializer expressions E(i) to be evaluated | 8 // Expect the initializer expressions E(i) to be evaluated |
9 // in the order 1, 2, 3, ... | 9 // in the order 1, 2, 3, ... |
10 // Each expression must be evaluated exactly once. | 10 // Each expression must be evaluated exactly once. |
(...skipping 11 matching lines...) Expand all Loading... |
22 Expect.equals(2, x); | 22 Expect.equals(2, x); |
23 Expect.equals(3, y); | 23 Expect.equals(3, y); |
24 Expect.equals(4, a1); | 24 Expect.equals(4, a1); |
25 E(6); | 25 E(6); |
26 } | 26 } |
27 } | 27 } |
28 | 28 |
29 class B extends A { | 29 class B extends A { |
30 var b1, b2; | 30 var b1, b2; |
31 | 31 |
32 B(x) : b1 = E(1), super(E(2), E(3)), b2 = E(5) { | 32 B(x) |
| 33 : b1 = E(1), |
| 34 super(E(2), E(3)), |
| 35 b2 = E(5) { |
33 Expect.equals(1, b1); | 36 Expect.equals(1, b1); |
34 Expect.equals(5, b2); | 37 Expect.equals(5, b2); |
35 E(7); | 38 E(7); |
36 } | 39 } |
37 } | 40 } |
38 | 41 |
39 main() { | 42 main() { |
40 var b = new B(0); | 43 var b = new B(0); |
41 Expect.equals("1-2-3-4-5-6-7-", trace); | 44 Expect.equals("1-2-3-4-5-6-7-", trace); |
42 } | 45 } |
OLD | NEW |