OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 library futures_test; | 5 library futures_test; |
| 6 import "package:expect/expect.dart"; |
6 import 'dart:async'; | 7 import 'dart:async'; |
7 import 'dart:isolate'; | 8 import 'dart:isolate'; |
8 | 9 |
9 Future testWaitEmpty() { | 10 Future testWaitEmpty() { |
10 List<Future> futures = new List<Future>(); | 11 List<Future> futures = new List<Future>(); |
11 return Future.wait(futures); | 12 return Future.wait(futures); |
12 } | 13 } |
13 | 14 |
14 Future testCompleteAfterWait() { | 15 Future testCompleteAfterWait() { |
15 List<Future> futures = new List<Future>(); | 16 List<Future> futures = new List<Future>(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 futures.add(testForEachWithException()); | 115 futures.add(testForEachWithException()); |
115 | 116 |
116 // Use a receive port for blocking the test. | 117 // Use a receive port for blocking the test. |
117 // Note that if the test fails, the program will not end. | 118 // Note that if the test fails, the program will not end. |
118 ReceivePort port = new ReceivePort(); | 119 ReceivePort port = new ReceivePort(); |
119 Future.wait(futures).then((List list) { | 120 Future.wait(futures).then((List list) { |
120 Expect.equals(9, list.length); | 121 Expect.equals(9, list.length); |
121 port.close(); | 122 port.close(); |
122 }); | 123 }); |
123 } | 124 } |
OLD | NEW |