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

Unified Diff: tests/isolate/message3_test.dart

Issue 1151013005: Serialize maps without hashes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: _getIndexSize and name constant Created 5 years, 7 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 | « runtime/vm/snapshot.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/message3_test.dart
diff --git a/tests/isolate/message3_test.dart b/tests/isolate/message3_test.dart
index a29c8f94a931772a040b62313c68ff09c5504ecc..c07a7e68329820d9aa0e660c28e3fb5c4d808b17 100644
--- a/tests/isolate/message3_test.dart
+++ b/tests/isolate/message3_test.dart
@@ -211,6 +211,8 @@ void runTests(SendPort ping, Queue checks) {
Expect.isTrue(x is LinkedHashMap);
Expect.listEquals(["foo", "bar"], x.keys.toList());
Expect.listEquals([499, 32], x.values.toList());
+ Expect.equals(499, x["foo"]);
+ Expect.equals(32, x["bar"]);
// Must be mutable.
x["foo"] = 22;
Expect.equals(22, x["foo"]);
@@ -219,6 +221,28 @@ void runTests(SendPort ping, Queue checks) {
Expect.equals(499, x["gee"]);
});
+ Map<String, int> mapWithRemovedKey = {"foo": 499, "bar": 32};
+ mapWithRemovedKey.remove("foo");
+ ping.send(mapWithRemovedKey);
+ checks.add((x) {
+ Expect.isTrue(x is LinkedHashMap);
+ Expect.listEquals(["bar"], x.keys.toList());
+ Expect.listEquals([32], x.values.toList());
+ Expect.equals(32, x["bar"]);
+ });
+
+ // Test map where a key does not define ==/hashCode.
+ Map<A, int> mapWithIdentityKey = new Map<A, int>();
+ mapWithIdentityKey[new A()] = 499;
+ ping.send(mapWithIdentityKey);
+ checks.add((x) {
+ Expect.isTrue(x is LinkedHashMap);
+ int value = x.values.first;
+ Expect.equals(499, value);
+ A key = x.keys.first;
+ Expect.equals(499, x[key]);
+ });
+
ping.send({0: 499, 1: 32});
checks.add((x) {
Expect.isTrue(x is LinkedHashMap);
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698