Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: pkg/unittest/lib/src/test_case.dart

Issue 416133002: Abort unit tests in the event of async failure while awaiting a future. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..cde0eeed9e51abed6a1759ce13d4f6e1775989d9 100644
--- a/pkg/unittest/lib/src/test_case.dart
+++ b/pkg/unittest/lib/src/test_case.dart
@@ -99,7 +99,11 @@ class TestCase {
_startTime = new DateTime.now();
_runningTime = null;
++_callbackFunctionsOutstanding;
- return _testFunction();
+ var testReturn = _testFunction();
+ if (testReturn is Future) {
+ ++_callbackFunctionsOutstanding;
+ testReturn.catchError(_errorHandler('Test')).whenComplete(_markCallbackComplete);
kevmoo 2014/07/29 19:59:01 long line Also, would you add a note explaining t
Paul Berry 2014/07/29 21:54:38 Done.
+ }
}).catchError(_errorHandler('Test')).then((_) {
_markCallbackComplete();
if (result == null) {

Powered by Google App Engine
This is Rietveld 408576698