OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 class A { | 7 class A { |
8 final x; | 8 final x; |
9 final y; | 9 final y; |
10 final z; | 10 final z; |
11 final t; | 11 final t; |
12 | 12 |
13 const A([this.z = 99, tt = 100]) : y = 499, t = tt, x = 3; | 13 const A([this.z = 99, tt = 100]) : y = 499, t = tt, x = 3; |
14 const A.n({this.z: 99, tt: 100}) : y = 499, t = tt, x = 3; | 14 const A.n({this.z: 99, tt: 100}) : y = 499, t = tt, x = 3; |
15 const A.named({z, this.t}) : y = 400 + z, this.z = z, x = 3; | 15 const A.named({z, this.t}) : y = 400 + z, this.z = z, x = 3; |
16 const A.named2({t, z, y, x}) : x = t, y = z, z = y, t = x; | 16 const A.named2({t, z, y, x}) : x = t, y = z, z = y, t = x; |
17 | 17 |
18 toString() => "A $x $y $z $t"; | 18 toString() => "A $x $y $z $t"; |
19 } | 19 } |
20 | 20 |
21 const a1 = const A(99, 100); | 21 const a1 = const A(99, 100); |
22 const a1n = const A.n(99, 100); | |
Johnni Winther
2016/07/05 10:34:16
Unused in test.
| |
23 const a2 = const A.named(z: 99, t: 100); | 22 const a2 = const A.named(z: 99, t: 100); |
24 const a3 = const A.named2(t: 1, z: 2, y: 3, x: 4); | 23 const a3 = const A.named2(t: 1, z: 2, y: 3, x: 4); |
25 const a4 = const A(); | 24 const a4 = const A(); |
26 const a5 = const A(99, 100); | 25 const a5 = const A(99, 100); |
27 const a5n = const A.n(tt: 100, z: 99); | 26 const a5n = const A.n(tt: 100, z: 99); |
28 const a6 = const A(1, 2); | 27 const a6 = const A(1, 2); |
29 const a6n = const A.n(z: 1, tt: 2); | 28 const a6n = const A.n(z: 1, tt: 2); |
30 const a7 = const A.named(z: 7); | 29 const a7 = const A.named(z: 7); |
31 const a8 = const A.named2(); | 30 const a8 = const A.named2(); |
32 const a9 = const A.named2(x: 4, y: 3, z: 2, t: 1); | 31 const a9 = const A.named2(x: 4, y: 3, z: 2, t: 1); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 Expect.equals("A null null null null", a8.toString()); | 66 Expect.equals("A null null null null", a8.toString()); |
68 | 67 |
69 Expect.isTrue(identical(a3, a9)); | 68 Expect.isTrue(identical(a3, a9)); |
70 | 69 |
71 Expect.equals(4, a10.x); | 70 Expect.equals(4, a10.x); |
72 Expect.equals(3, a10.y); | 71 Expect.equals(3, a10.y); |
73 Expect.equals(2, a10.z); | 72 Expect.equals(2, a10.z); |
74 Expect.equals(1, a10.t); | 73 Expect.equals(1, a10.t); |
75 Expect.equals("A 4 3 2 1", a10.toString()); | 74 Expect.equals("A 4 3 2 1", a10.toString()); |
76 } | 75 } |
OLD | NEW |