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 ## | 10 /// ## Installing ## |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 /// [pub]: http://pub.dartlang.org | 188 /// [pub]: http://pub.dartlang.org |
189 /// [pkg]: http://pub.dartlang.org/packages/scheduled_test | 189 /// [pkg]: http://pub.dartlang.org/packages/scheduled_test |
190 library scheduled_test; | 190 library scheduled_test; |
191 | 191 |
192 import 'dart:async'; | 192 import 'dart:async'; |
193 | 193 |
194 import 'package:unittest/unittest.dart' as unittest; | 194 import 'package:unittest/unittest.dart' as unittest; |
195 | 195 |
196 import 'src/schedule.dart'; | 196 import 'src/schedule.dart'; |
197 import 'src/schedule_error.dart'; | 197 import 'src/schedule_error.dart'; |
198 import 'src/utils.dart'; | |
199 | 198 |
200 export 'package:unittest/matcher.dart' hide completes, completion; | 199 export 'package:unittest/matcher.dart' hide completes, completion; |
201 export 'package:unittest/unittest.dart' show | 200 export 'package:unittest/unittest.dart' show |
202 Configuration, logMessage, expectThrow; | 201 Configuration, logMessage, expectThrow; |
203 | 202 |
204 export 'src/schedule.dart'; | 203 export 'src/schedule.dart'; |
205 export 'src/schedule_error.dart'; | 204 export 'src/schedule_error.dart'; |
206 export 'src/scheduled_future_matchers.dart'; | 205 export 'src/scheduled_future_matchers.dart'; |
207 export 'src/task.dart'; | 206 export 'src/task.dart'; |
208 | 207 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 'still running.'); | 319 'still running.'); |
321 } | 320 } |
322 _currentSchedule = new Schedule(); | 321 _currentSchedule = new Schedule(); |
323 if (_setUpFn != null) { | 322 if (_setUpFn != null) { |
324 var parentFn = _setUpFn; | 323 var parentFn = _setUpFn; |
325 _setUpFn = () { parentFn(); setUpFn(); }; | 324 _setUpFn = () { parentFn(); setUpFn(); }; |
326 } else { | 325 } else { |
327 _setUpFn = setUpFn; | 326 _setUpFn = setUpFn; |
328 } | 327 } |
329 }); | 328 }); |
330 | 329 |
331 unittest.tearDown(() { | 330 unittest.tearDown(() { |
332 _currentSchedule = null; | 331 _currentSchedule = null; |
333 _setUpFn = null; | 332 _setUpFn = null; |
334 }); | 333 }); |
335 } else { | 334 } else { |
336 unittest.setUp(() { | 335 unittest.setUp(() { |
337 if (currentSchedule == null) { | 336 if (currentSchedule == null) { |
338 throw new StateError('No schedule allocated.'); | 337 throw new StateError('No schedule allocated.'); |
339 } else if (_setUpFn != null) { | 338 } else if (_setUpFn != null) { |
340 var parentFn = _setUpFn; | 339 var parentFn = _setUpFn; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 376 |
378 return currentSchedule.wrapFuture(future, description); | 377 return currentSchedule.wrapFuture(future, description); |
379 } | 378 } |
380 | 379 |
381 // TODO(nweiz): re-export these once issue 9535 is fixed. | 380 // TODO(nweiz): re-export these once issue 9535 is fixed. |
382 unittest.Configuration get unittestConfiguration => | 381 unittest.Configuration get unittestConfiguration => |
383 unittest.unittestConfiguration; | 382 unittest.unittestConfiguration; |
384 void set unittestConfiguration(unittest.Configuration value) { | 383 void set unittestConfiguration(unittest.Configuration value) { |
385 unittest.unittestConfiguration = value; | 384 unittest.unittestConfiguration = value; |
386 } | 385 } |
OLD | NEW |