| 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"; | 5 import "package:expect/expect.dart"; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 | 7 |
| 8 main() { | 8 main() { |
| 9 defaultFunctionValuesTest(); | 9 defaultFunctionValuesTest(); |
| 10 defaultKeyFunctionTest(); | 10 defaultKeyFunctionTest(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 Expect.equals(2, map.length); | 95 Expect.equals(2, map.length); |
| 96 Expect.equals(2, map.keys.length); | 96 Expect.equals(2, map.keys.length); |
| 97 Expect.equals(2, map.values.length); | 97 Expect.equals(2, map.values.length); |
| 98 | 98 |
| 99 Expect.equals(1, map[2]); | 99 Expect.equals(1, map[2]); |
| 100 Expect.equals(2, map[3]); | 100 Expect.equals(2, map[3]); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void genericTypeTest() { | 103 void genericTypeTest() { |
| 104 var map = new LinkedHashMap<int, String>.fromIterable([1, 2, 3], value: (x) =>
'$x'); | 104 var map = new LinkedHashMap<int, String>.fromIterable( |
| 105 <int>[1, 2, 3], value: (x) => '$x'); |
| 105 Expect.isTrue(map is Map<int, String>); | 106 Expect.isTrue(map is Map<int, String>); |
| 106 Expect.isTrue(map is LinkedHashMap<int, String>); | 107 Expect.isTrue(map is LinkedHashMap<int, String>); |
| 107 | 108 |
| 109 map = new LinkedHashMap<String, String>.fromIterable( |
| 110 <int>[1, 2, 3], key: (x) => '$x', value: (x) => '$x'); |
| 111 Expect.isTrue(map is Map<String, String>); |
| 112 Expect.isTrue(map is LinkedHashMap<String, String>); |
| 113 |
| 108 // Make sure it is not just LinkedHashMap<dynamic, dynamic>. | 114 // Make sure it is not just LinkedHashMap<dynamic, dynamic>. |
| 109 Expect.isFalse(map is LinkedHashMap<String, dynamic>); | 115 Expect.isFalse(map is LinkedHashMap<int, dynamic>); |
| 110 Expect.isFalse(map is LinkedHashMap<dynamic, int>); | 116 Expect.isFalse(map is LinkedHashMap<dynamic, int>); |
| 111 } | 117 } |
| 112 | |
| OLD | NEW |