| 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 /// ## Installing ## |
| 11 /// |
| 12 /// Use [pub][] to install this package. Add the following to your |
| 13 /// `pubspec.yaml` file. |
| 14 /// |
| 15 /// dependencies: |
| 16 /// scheduled_test: any |
| 17 /// |
| 18 /// Then run `pub install`. |
| 19 /// |
| 20 /// For more information, see the |
| 21 /// [scheduled_test package on pub.dartlang.org][pkg]. |
| 22 /// |
| 10 /// This package works by building up a queue of asynchronous tasks called a | 23 /// This package works by building up a queue of asynchronous tasks called a |
| 11 /// "schedule", then executing those tasks in order. This allows the tests to | 24 /// "schedule", then executing those tasks in order. This allows the tests to |
| 12 /// read like synchronous, linear code, despite executing asynchronously. | 25 /// read like synchronous, linear code, despite executing asynchronously. |
| 13 /// | 26 /// |
| 14 /// The `scheduled_test` package is built on top of `unittest`, and should be | 27 /// The `scheduled_test` package is built on top of `unittest`, and should be |
| 15 /// imported instead of `unittest`. It provides its own version of [group], | 28 /// imported instead of `unittest`. It provides its own version of [group], |
| 16 /// [test], and [setUp], and re-exports most other APIs from unittest. | 29 /// [test], and [setUp], and re-exports most other APIs from unittest. |
| 17 /// | 30 /// |
| 18 /// To schedule a task, call the [schedule] function. For example: | 31 /// To schedule a task, call the [schedule] function. For example: |
| 19 /// | 32 /// |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 /// `scheduled_test` has a built-in timeout of 30 seconds (configurable via | 177 /// `scheduled_test` has a built-in timeout of 30 seconds (configurable via |
| 165 /// [Schedule.timeout]). This timeout is aware of the structure of the schedule; | 178 /// [Schedule.timeout]). This timeout is aware of the structure of the schedule; |
| 166 /// this means that it will reset for each task in a queue, when moving between | 179 /// this means that it will reset for each task in a queue, when moving between |
| 167 /// queues, or almost any other sort of interaction with [currentSchedule]. As | 180 /// queues, or almost any other sort of interaction with [currentSchedule]. As |
| 168 /// long as the [Schedule] knows your test is making some sort of progress, it | 181 /// long as the [Schedule] knows your test is making some sort of progress, it |
| 169 /// won't time out. | 182 /// won't time out. |
| 170 /// | 183 /// |
| 171 /// If a single task might take a long time, you can also manually tell the | 184 /// If a single task might take a long time, you can also manually tell the |
| 172 /// [Schedule] that it's making progress by calling [Schedule.heartbeat], which | 185 /// [Schedule] that it's making progress by calling [Schedule.heartbeat], which |
| 173 /// will reset the timeout whenever it's called. | 186 /// will reset the timeout whenever it's called. |
| 187 /// |
| 188 /// [pub]: http://pub.dartlang.org |
| 189 /// [pkg]: http://pub.dartlang.org/packages/scheduled_test |
| 174 library scheduled_test; | 190 library scheduled_test; |
| 175 | 191 |
| 176 import 'dart:async'; | 192 import 'dart:async'; |
| 177 | 193 |
| 178 import 'package:unittest/unittest.dart' as unittest; | 194 import 'package:unittest/unittest.dart' as unittest; |
| 179 | 195 |
| 180 import 'src/schedule.dart'; | 196 import 'src/schedule.dart'; |
| 181 import 'src/schedule_error.dart'; | 197 import 'src/schedule_error.dart'; |
| 182 import 'src/utils.dart'; | 198 import 'src/utils.dart'; |
| 183 | 199 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 358 |
| 343 return currentSchedule.wrapFuture(future, description); | 359 return currentSchedule.wrapFuture(future, description); |
| 344 } | 360 } |
| 345 | 361 |
| 346 // TODO(nweiz): re-export these once issue 9535 is fixed. | 362 // TODO(nweiz): re-export these once issue 9535 is fixed. |
| 347 unittest.Configuration get unittestConfiguration => | 363 unittest.Configuration get unittestConfiguration => |
| 348 unittest.unittestConfiguration; | 364 unittest.unittestConfiguration; |
| 349 void set unittestConfiguration(unittest.Configuration value) { | 365 void set unittestConfiguration(unittest.Configuration value) { |
| 350 unittest.unittestConfiguration = value; | 366 unittest.unittestConfiguration = value; |
| 351 } | 367 } |
| OLD | NEW |