Index: tests/corelib/map_test.dart |
diff --git a/tests/corelib/map_test.dart b/tests/corelib/map_test.dart |
index 05afcf688f509b965ad40eb53c6112747891af22..4f48be4a085d1f8d7cfaa25425faad4b11042de6 100644 |
--- a/tests/corelib/map_test.dart |
+++ b/tests/corelib/map_test.dart |
@@ -207,6 +207,41 @@ void testMap(Map map, key1, key2, key3, key4, key5, key6, key7, key8) { |
Expect.equals(10, map[key1]); |
Expect.equals(10, |
map.putIfAbsent(key1, () => 11)); |
+ |
+ // Test Map.addAll. |
+ map.clear(); |
+ otherMap.clear(); |
+ otherMap[99] = 1; |
+ otherMap[50] = 50; |
+ otherMap[1] = 99; |
+ map.addAll(otherMap); |
+ Expect.equals(3, map.length); |
+ Expect.equals(1, map[99]); |
+ Expect.equals(50, map[50]); |
+ Expect.equals(99, map[1]); |
+ otherMap[50] = 42; |
+ map.addAll(new HashMap.from(otherMap)); |
+ Expect.equals(3, map.length); |
+ Expect.equals(1, map[99]); |
+ Expect.equals(42, map[50]); |
+ Expect.equals(99, map[1]); |
+ otherMap[99] = 7; |
+ map.addAll(new SplayTreeMap.from(otherMap)); |
+ Expect.equals(3, map.length); |
+ Expect.equals(7, map[99]); |
+ Expect.equals(42, map[50]); |
+ Expect.equals(99, map[1]); |
+ otherMap.remove(99); |
+ map[99] = 0; |
+ map.addAll(otherMap); |
+ Expect.equals(3, map.length); |
+ Expect.equals(0, map[99]); |
+ Expect.equals(42, map[50]); |
+ Expect.equals(99, map[1]); |
+ map.clear(); |
+ otherMap.clear(); |
+ map.addAll(otherMap); |
+ Expect.equals(0, map.length); |
} |
void testDeletedElement(Map map) { |