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 that map literals are ordered. | 5 // Tests that map literals are ordered. |
8 | 6 |
9 class OrderedMapsTest { | 7 class OrderedMapsTest { |
10 static testMain() { | 8 static testMain() { |
11 testMaps(const { "a": 1, "c": 2 }, const { "c": 2, "a": 1}, true); | 9 testMaps(const { "a": 1, "c": 2 }, const { "c": 2, "a": 1}, true); |
12 testMaps({ "a": 1, "c": 2 }, { "c": 2, "a": 1 }, false); | 10 testMaps({ "a": 1, "c": 2 }, { "c": 2, "a": 1 }, false); |
13 } | 11 } |
14 | 12 |
15 static void testMaps(map1, map2, bool isConst) { | 13 static void testMaps(map1, map2, bool isConst) { |
16 Expect.isFalse(identical(map1, map2)); | 14 Expect.isFalse(identical(map1, map2)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 69 |
72 values = map1.values.toList(); | 70 values = map1.values.toList(); |
73 Expect.equals(3, values.length); | 71 Expect.equals(3, values.length); |
74 Expect.equals(4, values[0]); | 72 Expect.equals(4, values[0]); |
75 } | 73 } |
76 } | 74 } |
77 | 75 |
78 main() { | 76 main() { |
79 OrderedMapsTest.testMain(); | 77 OrderedMapsTest.testMain(); |
80 } | 78 } |
OLD | NEW |