Chromium Code Reviews| 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 `pubspec.yaml ` | |
|
Andrei Mouravski
2013/04/19 20:13:35
Line too long.
sethladd
2013/04/19 20:32:43
Done.
| |
| 13 /// file. | |
| 14 /// | |
| 15 /// dependencies: | |
| 16 /// scheduled_test: any | |
| 17 /// | |
| 18 /// And then run `pub install`. | |
| 19 /// | |
| 10 /// This package works by building up a queue of asynchronous tasks called a | 20 /// 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 | 21 /// "schedule", then executing those tasks in order. This allows the tests to |
| 12 /// read like synchronous, linear code, despite executing asynchronously. | 22 /// read like synchronous, linear code, despite executing asynchronously. |
| 13 /// | 23 /// |
| 14 /// The `scheduled_test` package is built on top of `unittest`, and should be | 24 /// 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], | 25 /// imported instead of `unittest`. It provides its own version of [group], |
| 16 /// [test], and [setUp], and re-exports most other APIs from unittest. | 26 /// [test], and [setUp], and re-exports most other APIs from unittest. |
| 17 /// | 27 /// |
| 18 /// To schedule a task, call the [schedule] function. For example: | 28 /// To schedule a task, call the [schedule] function. For example: |
| 19 /// | 29 /// |
| (...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 | 174 /// `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; | 175 /// [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 | 176 /// 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 | 177 /// 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 | 178 /// long as the [Schedule] knows your test is making some sort of progress, it |
| 169 /// won't time out. | 179 /// won't time out. |
| 170 /// | 180 /// |
| 171 /// If a single task might take a long time, you can also manually tell the | 181 /// 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 | 182 /// [Schedule] that it's making progress by calling [Schedule.heartbeat], which |
| 173 /// will reset the timeout whenever it's called. | 183 /// will reset the timeout whenever it's called. |
| 184 /// | |
| 185 /// [pub]: http://pub.dartlang.org | |
| 174 library scheduled_test; | 186 library scheduled_test; |
| 175 | 187 |
| 176 import 'dart:async'; | 188 import 'dart:async'; |
| 177 | 189 |
| 178 import 'package:unittest/unittest.dart' as unittest; | 190 import 'package:unittest/unittest.dart' as unittest; |
| 179 | 191 |
| 180 import 'src/schedule.dart'; | 192 import 'src/schedule.dart'; |
| 181 import 'src/schedule_error.dart'; | 193 import 'src/schedule_error.dart'; |
| 182 import 'src/utils.dart'; | 194 import 'src/utils.dart'; |
| 183 | 195 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 | 354 |
| 343 return currentSchedule.wrapFuture(future, description); | 355 return currentSchedule.wrapFuture(future, description); |
| 344 } | 356 } |
| 345 | 357 |
| 346 // TODO(nweiz): re-export these once issue 9535 is fixed. | 358 // TODO(nweiz): re-export these once issue 9535 is fixed. |
| 347 unittest.Configuration get unittestConfiguration => | 359 unittest.Configuration get unittestConfiguration => |
| 348 unittest.unittestConfiguration; | 360 unittest.unittestConfiguration; |
| 349 void set unittestConfiguration(unittest.Configuration value) { | 361 void set unittestConfiguration(unittest.Configuration value) { |
| 350 unittest.unittestConfiguration = value; | 362 unittest.unittestConfiguration = value; |
| 351 } | 363 } |
| OLD | NEW |