| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (_setUpFn != null) _setUpFn(); | 221 if (_setUpFn != null) _setUpFn(); |
| 222 body(); | 222 body(); |
| 223 }).then((_) { | 223 }).then((_) { |
| 224 // If we got here, the test completed successfully so tell unittest so. | 224 // If we got here, the test completed successfully so tell unittest so. |
| 225 asyncDone(); | 225 asyncDone(); |
| 226 }).catchError((e) { | 226 }).catchError((e) { |
| 227 if (e is ScheduleError) { | 227 if (e is ScheduleError) { |
| 228 assert(e.schedule.errors.contains(e)); | 228 assert(e.schedule.errors.contains(e)); |
| 229 assert(e.schedule == currentSchedule); | 229 assert(e.schedule == currentSchedule); |
| 230 unittest.registerException(e.schedule.errorString()); | 230 unittest.registerException(e.schedule.errorString()); |
| 231 } else if (e is AsyncError) { | |
| 232 unittest.registerException(e.error, e.stackTrace); | |
| 233 } else { | 231 } else { |
| 234 unittest.registerException(e); | 232 unittest.registerException(e); |
| 235 } | 233 } |
| 236 }); | 234 }); |
| 237 }); | 235 }); |
| 238 } | 236 } |
| 239 | 237 |
| 240 /// Whether or not the tests currently being defined are in a group. This is | 238 /// Whether or not the tests currently being defined are in a group. This is |
| 241 /// only true when defining tests, not when executing them. | 239 /// only true when defining tests, not when executing them. |
| 242 bool _inGroup = false; | 240 bool _inGroup = false; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 342 |
| 345 return currentSchedule.wrapFuture(future, description); | 343 return currentSchedule.wrapFuture(future, description); |
| 346 } | 344 } |
| 347 | 345 |
| 348 // TODO(nweiz): re-export these once issue 9535 is fixed. | 346 // TODO(nweiz): re-export these once issue 9535 is fixed. |
| 349 unittest.Configuration get unittestConfiguration => | 347 unittest.Configuration get unittestConfiguration => |
| 350 unittest.unittestConfiguration; | 348 unittest.unittestConfiguration; |
| 351 void set unittestConfiguration(unittest.Configuration value) { | 349 void set unittestConfiguration(unittest.Configuration value) { |
| 352 unittest.unittestConfiguration = value; | 350 unittest.unittestConfiguration = value; |
| 353 } | 351 } |
| OLD | NEW |