Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: tests/corelib/map_test.dart

Issue 16406005: Add addAll to Map interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/core/map.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « sdk/lib/core/map.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698