| 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 // This test has no inheritance but many fields to flush out issues with | 10 // This test has no inheritance but many fields to flush out issues with |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 var h; | 23 var h; |
| 24 var g = 0; | 24 var g = 0; |
| 25 var f; | 25 var f; |
| 26 var e = 0; | 26 var e = 0; |
| 27 var d; | 27 var d; |
| 28 var c = 0; | 28 var c = 0; |
| 29 var b; | 29 var b; |
| 30 var a = 0; | 30 var a = 0; |
| 31 | 31 |
| 32 A() | 32 A() |
| 33 : a = E(1), // Initializations in different order to decls. Ascending... | 33 : a = E(1), // Initializations in different order to decls. Ascending... |
| 34 b = E(2), | 34 b = E(2), |
| 35 c = E(3), | 35 c = E(3), |
| 36 | 36 f = E(4), // Descending to be perverse... |
| 37 f = E(4), // Descending to be perverse... | 37 e = E(5), |
| 38 e = E(5), | 38 d = E(6), |
| 39 d = E(6), | 39 g = E(7), // Ascending again. |
| 40 | 40 h = E(8), |
| 41 g = E(7), // Ascending again. | 41 i = E(9), |
| 42 h = E(8), | 42 j = E(10) { |
| 43 i = E(9), | |
| 44 j = E(10) { | |
| 45 | |
| 46 Expect.equals(1, a); | 43 Expect.equals(1, a); |
| 47 Expect.equals(2, b); | 44 Expect.equals(2, b); |
| 48 Expect.equals(3, c); | 45 Expect.equals(3, c); |
| 49 | 46 |
| 50 Expect.equals(4, f); | 47 Expect.equals(4, f); |
| 51 Expect.equals(5, e); | 48 Expect.equals(5, e); |
| 52 Expect.equals(6, d); | 49 Expect.equals(6, d); |
| 53 | 50 |
| 54 Expect.equals(7, g); | 51 Expect.equals(7, g); |
| 55 Expect.equals(8, h); | 52 Expect.equals(8, h); |
| 56 Expect.equals(9, i); | 53 Expect.equals(9, i); |
| 57 Expect.equals(10, j); | 54 Expect.equals(10, j); |
| 58 } | 55 } |
| 59 } | 56 } |
| 60 | 57 |
| 61 main() { | 58 main() { |
| 62 var x = new A(); | 59 var x = new A(); |
| 63 Expect.equals('1-2-3-4-5-6-7-8-9-10-', trace); | 60 Expect.equals('1-2-3-4-5-6-7-8-9-10-', trace); |
| 64 } | 61 } |
| OLD | NEW |