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

Side by Side 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, 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Dart test program for testing serialization of messages. 5 // Dart test program for testing serialization of messages.
6 // VMOptions=--enable_type_checks --enable_asserts 6 // VMOptions=--enable_type_checks --enable_asserts
7 7
8 library MessageTest; 8 library MessageTest;
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 Expect.equals(8, entry2.w); 204 Expect.equals(8, entry2.w);
205 } 205 }
206 ) /// int32x4: ok 206 ) /// int32x4: ok
207 ; 207 ;
208 208
209 ping.send({"foo": 499, "bar": 32}); 209 ping.send({"foo": 499, "bar": 32});
210 checks.add((x) { 210 checks.add((x) {
211 Expect.isTrue(x is LinkedHashMap); 211 Expect.isTrue(x is LinkedHashMap);
212 Expect.listEquals(["foo", "bar"], x.keys.toList()); 212 Expect.listEquals(["foo", "bar"], x.keys.toList());
213 Expect.listEquals([499, 32], x.values.toList()); 213 Expect.listEquals([499, 32], x.values.toList());
214 Expect.equals(499, x["foo"]);
215 Expect.equals(32, x["bar"]);
214 // Must be mutable. 216 // Must be mutable.
215 x["foo"] = 22; 217 x["foo"] = 22;
216 Expect.equals(22, x["foo"]); 218 Expect.equals(22, x["foo"]);
217 // Must be extendable. 219 // Must be extendable.
218 x["gee"] = 499; 220 x["gee"] = 499;
219 Expect.equals(499, x["gee"]); 221 Expect.equals(499, x["gee"]);
220 }); 222 });
221 223
224 Map<String, int> mapWithRemovedKey = {"foo": 499, "bar": 32};
225 mapWithRemovedKey.remove("foo");
226 ping.send(mapWithRemovedKey);
227 checks.add((x) {
228 Expect.isTrue(x is LinkedHashMap);
229 Expect.listEquals(["bar"], x.keys.toList());
230 Expect.listEquals([32], x.values.toList());
231 Expect.equals(32, x["bar"]);
232 });
233
234 // Test map where a key does not define ==/hashCode.
235 Map<A, int> mapWithIdentityKey = new Map<A, int>();
236 mapWithIdentityKey[new A()] = 499;
237 ping.send(mapWithIdentityKey);
238 checks.add((x) {
239 Expect.isTrue(x is LinkedHashMap);
240 int value = x.values.first;
241 Expect.equals(499, value);
242 A key = x.keys.first;
243 Expect.equals(499, x[key]);
244 });
245
222 ping.send({0: 499, 1: 32}); 246 ping.send({0: 499, 1: 32});
223 checks.add((x) { 247 checks.add((x) {
224 Expect.isTrue(x is LinkedHashMap); 248 Expect.isTrue(x is LinkedHashMap);
225 Expect.listEquals([0, 1], x.keys.toList()); 249 Expect.listEquals([0, 1], x.keys.toList());
226 Expect.listEquals([499, 32], x.values.toList()); 250 Expect.listEquals([499, 32], x.values.toList());
227 // Must be mutable. 251 // Must be mutable.
228 x[0] = 22; 252 x[0] = 22;
229 Expect.equals(22, x[0]); 253 Expect.equals(22, x[0]);
230 // Must be extendable. 254 // Must be extendable.
231 x["gee"] = 499; 255 x["gee"] = 499;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 .spawn(echoMain, [initialReplyPort.sendPort, testPort.sendPort]) 453 .spawn(echoMain, [initialReplyPort.sendPort, testPort.sendPort])
430 .then((_) => initialReplyPort.first) 454 .then((_) => initialReplyPort.first)
431 .then((SendPort ping) { 455 .then((SendPort ping) {
432 runTests(ping, checks); 456 runTests(ping, checks);
433 Expect.isTrue(checks.length > 0); 457 Expect.isTrue(checks.length > 0);
434 completer.future 458 completer.future
435 .then((_) => ping.send("halt")) 459 .then((_) => ping.send("halt"))
436 .then((_) => asyncEnd()); 460 .then((_) => asyncEnd());
437 }); 461 });
438 } 462 }
OLDNEW
« 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