| Index: tests/isolate/src/CountTest.dart
|
| diff --git a/tests/isolate/src/CountTest.dart b/tests/isolate/src/CountTest.dart
|
| index 97b6f89b2d63a9407d6a6f1ec06878ca7fc7fae4..85c2955cd8d579b60d0be571f4f4ac3dc595a641 100644
|
| --- a/tests/isolate/src/CountTest.dart
|
| +++ b/tests/isolate/src/CountTest.dart
|
| @@ -4,7 +4,7 @@
|
|
|
| #library("CountTest");
|
| #import('dart:isolate');
|
| -#import("TestFramework.dart");
|
| +#import('../../../lib/unittest/unittest.dart');
|
|
|
| class TestIsolate extends Isolate {
|
|
|
| @@ -27,33 +27,27 @@ class TestIsolate extends Isolate {
|
| }
|
| }
|
|
|
| -void test(TestExpectation expect) {
|
| - int count = 0;
|
| - expect.completes(new TestIsolate().spawn()).then((SendPort remote) {
|
| - ReceivePort local = new ReceivePort();
|
| - SendPort reply = local.toSendPort();
|
| -
|
| - local.receive(expect.runs2((int message, SendPort replyTo) {
|
| - if (message == -1) {
|
| - Expect.equals(11, count);
|
| - local.close();
|
| - expect.succeeded();
|
| - return;
|
| - }
|
| -
|
| - Expect.equals((count - 1) * 2, message);
|
| +void main() {
|
| + test("count 10 consecutive messages", () {
|
| + int count = 0;
|
| + new TestIsolate().spawn().then(expectAsync1((SendPort remote) {
|
| + ReceivePort local = new ReceivePort();
|
| + SendPort reply = local.toSendPort();
|
| +
|
| + local.receive(expectAsync2((int message, SendPort replyTo) {
|
| + if (message == -1) {
|
| + Expect.equals(11, count);
|
| + local.close();
|
| + return;
|
| + }
|
| +
|
| + Expect.equals((count - 1) * 2, message);
|
| + remote.send(count++, reply);
|
| + if (count == 10) {
|
| + remote.send(-1, reply);
|
| + }
|
| + }, count: 11));
|
| remote.send(count++, reply);
|
| - if (count == 10) {
|
| - remote.send(-1, reply);
|
| - }
|
| }));
|
| - remote.send(count++, reply);
|
| });
|
| }
|
| -
|
| -void main() {
|
| - runTests([test]);
|
| -}
|
| -
|
| -
|
| -
|
|
|