| Index: pkg/unittest/lib/src/test_case.dart
|
| diff --git a/pkg/unittest/lib/src/test_case.dart b/pkg/unittest/lib/src/test_case.dart
|
| index 03eafd290d6211b421dccba4135c292c7e08559f..fe0d12de644455db83b0e0d5803a06f5a50d17b6 100644
|
| --- a/pkg/unittest/lib/src/test_case.dart
|
| +++ b/pkg/unittest/lib/src/test_case.dart
|
| @@ -99,7 +99,14 @@ class TestCase {
|
| _startTime = new DateTime.now();
|
| _runningTime = null;
|
| ++_callbackFunctionsOutstanding;
|
| - return _testFunction();
|
| + var testReturn = _testFunction();
|
| + // If _testFunction() returned a future, we want to wait for it like we
|
| + // would a callback, so if a failure occurs while waiting, we can abort.
|
| + if (testReturn is Future) {
|
| + ++_callbackFunctionsOutstanding;
|
| + testReturn.catchError(_errorHandler('Test'))
|
| + .whenComplete(_markCallbackComplete);
|
| + }
|
| }).catchError(_errorHandler('Test')).then((_) {
|
| _markCallbackComplete();
|
| if (result == null) {
|
|
|