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

Unified Diff: tests/corelib/map_test.dart

Issue 23890008: Revert "Make LinkedHashMap also have a factory constructor and be customizable" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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/collection/splay_tree.dart ('k') | tests/language/issue10561_test.dart » ('j') | 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 a70002720d8e1662683ba1269a90b7cd44528deb..c9ba29f56329d5406b11c94a27b1a1c71b5b1919 100644
--- a/tests/corelib/map_test.dart
+++ b/tests/corelib/map_test.dart
@@ -33,8 +33,6 @@ void main() {
testNumericKeys(new HashMap<num, String>(equals: identical));
testNumericKeys(new LinkedHashMap());
testNumericKeys(new LinkedHashMap<num, String>());
- testNumericKeys(new LinkedHashMap(equals: identical));
- testNumericKeys(new LinkedHashMap<num, String>(equals: identical));
testNaNKeys(new Map());
testNaNKeys(new Map<num, String>());
@@ -46,40 +44,10 @@ void main() {
// NaN is not equal to NaN.
testIdentityMap(new HashMap(equals: identical));
- testIdentityMap(new LinkedHashMap(equals: identical));
- testCustomMap(new HashMap(equals: myEquals, hashCode: myHashCode,
- isValidKey: (v) => v is Customer));
- testCustomMap(new LinkedHashMap(equals: myEquals, hashCode: myHashCode,
- isValidKey: (v) => v is Customer));
- testCustomMap(new HashMap<Customer,dynamic>(equals: myEquals,
- hashCode: myHashCode));
-
- testCustomMap(new LinkedHashMap<Customer,dynamic>(equals: myEquals,
- hashCode: myHashCode));
+ testCustomMap(new HashMap(equals: myEquals, hashCode: myHashCode));
testIterationOrder(new LinkedHashMap());
- testIterationOrder(new LinkedHashMap(equals: identical));
-
- testOtherKeys(new SplayTreeMap<int, int>());
- testOtherKeys(new SplayTreeMap<int, int>((int a, int b) => a - b,
- (v) => v is int));
- testOtherKeys(new SplayTreeMap((int a, int b) => a - b,
- (v) => v is int));
- testOtherKeys(new HashMap<int, int>());
- testOtherKeys(new HashMap<int, int>(equals: identical));
- testOtherKeys(new HashMap<int, int>(hashCode: (v) => v.hashCode,
- isValidKey: (v) => v is int));
- testOtherKeys(new HashMap(equals: (int x, int y) => x == y,
- hashCode: (int v) => v.hashCode,
- isValidKey: (v) => v is int));
- testOtherKeys(new LinkedHashMap<int, int>());
- testOtherKeys(new LinkedHashMap<int, int>(equals: identical));
- testOtherKeys(new LinkedHashMap<int, int>(hashCode: (v) => v.hashCode,
- isValidKey: (v) => v is int));
- testOtherKeys(new LinkedHashMap(equals: (int x, int y) => x == y,
- hashCode: (int v) => v.hashCode,
- isValidKey: (v) => v is int));
}
@@ -674,26 +642,9 @@ class Customer {
int myHashCode(Customer c) => c.secondId;
bool myEquals(Customer a, Customer b) => a.secondId == b.secondId;
-void testIterationOrder(Map map) {
+testIterationOrder(Map map) {
var order = [0, 6, 4, 2, 7, 9, 7, 1, 2, 5, 3];
for (int i = 0; i < order.length; i++) map[order[i]] = i;
Expect.listEquals(map.keys.toList(), [0, 6, 4, 2, 7, 9, 1, 5, 3]);
Expect.listEquals(map.values.toList(), [0, 1, 2, 8, 6, 5, 7, 9, 10]);
}
-
-void testOtherKeys(Map<int, int> map) {
- // Test that non-int keys are allowed in containsKey/remove/lookup.
- // Custom hash sets and tree sets must be constructed so they don't
- // use the equality/comparator on incompatible objects.
-
- // This should not throw in either checked or unchecked mode.
- map[0] = 0;
- map[1] = 1;
- map[2] = 2;
- Expect.isFalse(map.containsKey("not an int"));
- Expect.isFalse(map.containsKey(1.5));
- Expect.isNull(map.remove("not an int"));
- Expect.isNull(map.remove(1.5));
- Expect.isNull(map["not an int"]);
- Expect.isNull(map[1.5]);
-}
« no previous file with comments | « sdk/lib/collection/splay_tree.dart ('k') | tests/language/issue10561_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698