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 testing static const fields. | 4 // Dart test program for testing static const fields. |
5 | 5 |
6 abstract class Spain { | 6 abstract class Spain { |
7 static const AG = "Antoni Gaudi"; | 7 static const AG = "Antoni Gaudi"; |
8 static const SD = "Salvador Dali"; | 8 static const SD = "Salvador Dali"; |
9 } | 9 } |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 static const architect1 = Spain.AG; | 29 static const architect1 = Spain.AG; |
30 static const array1 = const <int>[1, 2]; | 30 static const array1 = const <int>[1, 2]; |
31 static const map1 = const {"Monday": 1, "Tuesday": 2, }; | 31 static const map1 = const {"Monday": 1, "Tuesday": 2, }; |
32 } | 32 } |
33 | 33 |
34 class StaticFinalFieldTest { | 34 class StaticFinalFieldTest { |
35 static testMain() { | 35 static testMain() { |
36 Expect.equals(15, A.c); | 36 Expect.equals(15, A.c); |
37 Expect.equals(8, A.b); | 37 Expect.equals(8, A.b); |
38 Expect.equals(5, A.a.n); | 38 Expect.equals(5, A.a.n); |
39 Expect.equals(true, 8 === A.b); | 39 Expect.equals(true, identical(8, A.b)); |
40 Expect.equals(true, A.a === A.d); | 40 Expect.equals(true, identical(A.a, A.d)); |
41 Expect.equals(true, A.s1 === A.s2); | 41 Expect.equals(true, identical(A.s1, A.s2)); |
42 Expect.equals(false, A.s1 === A.s3); | 42 Expect.equals(false, identical(A.s1, A.s3)); |
43 Expect.equals(false, A.s1 === A.b); | 43 Expect.equals(false, identical(A.s1, A.b)); |
44 Expect.equals(true, A.d1 === A.d2); | 44 Expect.equals(true, identical(A.d1, A.d2)); |
45 Expect.equals(true, Spain.SD == "Salvador Dali"); | 45 Expect.equals(true, Spain.SD == "Salvador Dali"); |
46 Expect.equals(true, A.artist2 == "Alberto Giacometti"); | 46 Expect.equals(true, A.artist2 == "Alberto Giacometti"); |
47 Expect.equals(true, A.architect1 == "Antoni Gaudi"); | 47 Expect.equals(true, A.architect1 == "Antoni Gaudi"); |
48 Expect.equals(2, A.map1["Tuesday"]); | 48 Expect.equals(2, A.map1["Tuesday"]); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 main() { | 52 main() { |
53 StaticFinalFieldTest.testMain(); | 53 StaticFinalFieldTest.testMain(); |
54 } | 54 } |
OLD | NEW |