OLD | NEW |
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 ping.send(g2); | 387 ping.send(g2); |
388 ping.send(g3); | 388 ping.send(g3); |
389 | 389 |
390 checks.add((x) { // g1. | 390 checks.add((x) { // g1. |
391 Expect.isTrue(x is G); | 391 Expect.isTrue(x is G); |
392 Expect.isFalse(identical(g1, x)); | 392 Expect.isFalse(identical(g1, x)); |
393 F f = x.field; | 393 F f = x.field; |
394 Expect.equals("field", f.field); | 394 Expect.equals("field", f.field); |
395 Expect.isFalse(identical(nonConstF, f)); | 395 Expect.isFalse(identical(nonConstF, f)); |
396 }); | 396 }); |
397 checks.add((x) { // g1. | 397 checks.add((x) { // g2. |
398 Expect.isTrue(x is G); | 398 Expect.isTrue(x is G); |
399 Expect.isFalse(identical(g1, x)); | 399 Expect.isFalse(identical(g1, x)); |
400 F f = x.field; | 400 F f = x.field; |
401 Expect.equals("field", f.field); | 401 Expect.equals("field", f.field); |
402 Expect.identical(constF, f); /// constInstance: continued | 402 Expect.identical(constF, f); /// constInstance: continued |
403 }); | 403 }); |
404 checks.add((x) { // g3. | 404 checks.add((x) { // g3. |
405 Expect.isTrue(x is G); | 405 Expect.isTrue(x is G); |
406 Expect.identical(g1, x); /// constInstance: continued | 406 Expect.identical(g3, x); /// constInstance: continued |
407 F f = x.field; | 407 F f = x.field; |
408 Expect.equals("field", f.field); | 408 Expect.equals("field", f.field); |
409 Expect.identical(constF, f); /// constInstance: continued | 409 Expect.identical(constF, f); /// constInstance: continued |
410 }); | 410 }); |
411 | 411 |
412 // Make sure objects in a map are serialized and deserialized in the correct | 412 // Make sure objects in a map are serialized and deserialized in the correct |
413 // order. | 413 // order. |
414 Map m = new Map(); | 414 Map m = new Map(); |
415 Value val1 = new Value(1); | 415 Value val1 = new Value(1); |
416 Value val2 = new Value(2); | 416 Value val2 = new Value(2); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 .spawn(echoMain, [initialReplyPort.sendPort, testPort.sendPort]) | 453 .spawn(echoMain, [initialReplyPort.sendPort, testPort.sendPort]) |
454 .then((_) => initialReplyPort.first) | 454 .then((_) => initialReplyPort.first) |
455 .then((SendPort ping) { | 455 .then((SendPort ping) { |
456 runTests(ping, checks); | 456 runTests(ping, checks); |
457 Expect.isTrue(checks.length > 0); | 457 Expect.isTrue(checks.length > 0); |
458 completer.future | 458 completer.future |
459 .then((_) => ping.send("halt")) | 459 .then((_) => ping.send("halt")) |
460 .then((_) => asyncEnd()); | 460 .then((_) => asyncEnd()); |
461 }); | 461 }); |
462 } | 462 } |
OLD | NEW |