| 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 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
| 8 | 8 |
| 9 Future testWaitEmpty() { | 9 Future testWaitEmpty() { |
| 10 List<Future> futures = new List<Future>(); | 10 List<Future> futures = new List<Future>(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 List<Future> futures = new List<Future>(); | 104 List<Future> futures = new List<Future>(); |
| 105 | 105 |
| 106 futures.add(testWaitEmpty()); | 106 futures.add(testWaitEmpty()); |
| 107 futures.add(testCompleteAfterWait()); | 107 futures.add(testCompleteAfterWait()); |
| 108 futures.add(testCompleteBeforeWait()); | 108 futures.add(testCompleteBeforeWait()); |
| 109 futures.add(testWaitWithMultipleValues()); | 109 futures.add(testWaitWithMultipleValues()); |
| 110 futures.add(testWaitWithSingleError()); | 110 futures.add(testWaitWithSingleError()); |
| 111 futures.add(testWaitWithMultipleErrors()); | 111 futures.add(testWaitWithMultipleErrors()); |
| 112 futures.add(testForEachEmpty()); | 112 futures.add(testForEachEmpty()); |
| 113 futures.add(testForEach()); | 113 futures.add(testForEach()); |
| 114 futures.add(testForEachWithException()); |
| 114 | 115 |
| 115 // Use a receive port for blocking the test. | 116 // Use a receive port for blocking the test. |
| 116 // Note that if the test fails, the program will not end. | 117 // Note that if the test fails, the program will not end. |
| 117 ReceivePort port = new ReceivePort(); | 118 ReceivePort port = new ReceivePort(); |
| 118 Future.wait(futures).then((List list) { | 119 Future.wait(futures).then((List list) { |
| 119 Expect.equals(8, list.length); | 120 Expect.equals(9, list.length); |
| 120 port.close(); | 121 port.close(); |
| 121 }); | 122 }); |
| 122 } | 123 } |
| OLD | NEW |