| Index: tests/isolate/illegal_msg_mirror_test.dart
|
| diff --git a/tests/isolate/illegal_msg_mirror_test.dart b/tests/isolate/illegal_msg_mirror_test.dart
|
| index eed29812dac2508ff2b3d2e24d01dfc5fe235c26..dcf80a01d6d480bd0925efbbe3e22a3103bc1953 100644
|
| --- a/tests/isolate/illegal_msg_mirror_test.dart
|
| +++ b/tests/isolate/illegal_msg_mirror_test.dart
|
| @@ -4,11 +4,12 @@
|
|
|
| library illegal_msg_mirror_test;
|
|
|
| -import "package:expect/expect.dart";
|
| import "dart:isolate";
|
| import "dart:async" show Future;
|
| -import "package:async_helper/async_helper.dart";
|
| +@MirrorsUsed(targets: "Class")
|
| import "dart:mirrors";
|
| +import "package:unittest/unittest.dart";
|
| +import "remote_unittest_helper.dart";
|
|
|
| class Class {
|
| method() {}
|
| @@ -22,31 +23,30 @@ echo(sendPort) {
|
| });
|
| }
|
|
|
| -main() {
|
| - var methodMirror = reflectClass(Class).declarations[#method];
|
| +void main([args, port]) {
|
| + if (testRemote(main, port)) return;
|
| + test("msg-mirror", () {
|
| + var methodMirror = reflectClass(Class).declarations[#method];
|
|
|
| - ReceivePort port = new ReceivePort();
|
| - Future spawn = Isolate.spawn(echo, port.sendPort);
|
| - var caught_exception = false;
|
| - var stream = port.asBroadcastStream();
|
| - asyncStart();
|
| - stream.first.then((snd) {
|
| - try {
|
| - snd.send(methodMirror);
|
| - } catch (e) {
|
| - caught_exception = true;
|
| - }
|
| + ReceivePort port = new ReceivePort();
|
| + Future spawn = Isolate.spawn(echo, port.sendPort);
|
| + var caught_exception = false;
|
| + var stream = port.asBroadcastStream();
|
| + stream.first.then(expectAsync1((snd) {
|
| + try {
|
| + snd.send(methodMirror);
|
| + } catch (e) {
|
| + caught_exception = true;
|
| + }
|
|
|
| - if (caught_exception) {
|
| - port.close();
|
| - } else {
|
| - asyncStart();
|
| - stream.first.then((msg) {
|
| - print("from worker ${msg}");
|
| - asyncEnd();
|
| - });
|
| - }
|
| - Expect.isTrue(caught_exception);
|
| - asyncEnd();
|
| + if (caught_exception) {
|
| + port.close();
|
| + } else {
|
| + stream.first.then(expectAsync1((msg) {
|
| + print("from worker ${msg}");
|
| + }));
|
| + }
|
| + expect(caught_exception, isTrue);
|
| + }));
|
| });
|
| }
|
|
|