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