OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // TODO(nweiz): Add support for calling [schedule] while the schedule is already | 5 // TODO(nweiz): Add support for calling [schedule] while the schedule is already |
6 // running. | 6 // running. |
7 // TODO(nweiz): Port the non-Pub-specific scheduled test libraries from Pub. | 7 // TODO(nweiz): Port the non-Pub-specific scheduled test libraries from Pub. |
8 /// A package for writing readable tests of asynchronous behavior. | 8 /// A package for writing readable tests of asynchronous behavior. |
9 /// | 9 /// |
10 /// This package works by building up a queue of asynchronous tasks called a | 10 /// This package works by building up a queue of asynchronous tasks called a |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 library scheduled_test; | 174 library scheduled_test; |
175 | 175 |
176 import 'dart:async'; | 176 import 'dart:async'; |
177 | 177 |
178 import 'package:unittest/unittest.dart' as unittest; | 178 import 'package:unittest/unittest.dart' as unittest; |
179 | 179 |
180 import 'src/schedule.dart'; | 180 import 'src/schedule.dart'; |
181 import 'src/schedule_error.dart'; | 181 import 'src/schedule_error.dart'; |
182 import 'src/utils.dart'; | 182 import 'src/utils.dart'; |
183 | 183 |
184 export 'package:unittest/matcher.dart'; | 184 export 'package:unittest/matcher.dart' hide completes, completion; |
185 export 'package:unittest/unittest.dart' show | 185 export 'package:unittest/unittest.dart' show |
186 config, configure, Configuration, logMessage, expectThrow; | 186 config, configure, Configuration, logMessage, expectThrow; |
187 | 187 |
188 export 'src/schedule.dart'; | 188 export 'src/schedule.dart'; |
189 export 'src/schedule_error.dart'; | 189 export 'src/schedule_error.dart'; |
| 190 export 'src/scheduled_future_matchers.dart'; |
190 export 'src/task.dart'; | 191 export 'src/task.dart'; |
191 | 192 |
192 /// The [Schedule] for the current test. This is used to add new tasks and | 193 /// The [Schedule] for the current test. This is used to add new tasks and |
193 /// inspect the state of the schedule. | 194 /// inspect the state of the schedule. |
194 /// | 195 /// |
195 /// This is `null` when there's no test currently running. | 196 /// This is `null` when there's no test currently running. |
196 Schedule get currentSchedule => _currentSchedule; | 197 Schedule get currentSchedule => _currentSchedule; |
197 Schedule _currentSchedule; | 198 Schedule _currentSchedule; |
198 | 199 |
199 /// The user-provided setUp function. This is set for each test during | 200 /// The user-provided setUp function. This is set for each test during |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 /// | 334 /// |
334 /// The returned [Future] completes to the same value or error as [future]. | 335 /// The returned [Future] completes to the same value or error as [future]. |
335 Future wrapFuture(Future future) { | 336 Future wrapFuture(Future future) { |
336 if (currentSchedule == null) { | 337 if (currentSchedule == null) { |
337 throw new StateError("Unexpected call to wrapFuture with no current " | 338 throw new StateError("Unexpected call to wrapFuture with no current " |
338 "schedule."); | 339 "schedule."); |
339 } | 340 } |
340 | 341 |
341 return currentSchedule.wrapFuture(future); | 342 return currentSchedule.wrapFuture(future); |
342 } | 343 } |
OLD | NEW |