Index: pkg/unittest/lib/unittest.dart |
diff --git a/pkg/unittest/lib/unittest.dart b/pkg/unittest/lib/unittest.dart |
index e96c9b20521f07f39dd665b06e4752297b98fef4..4b6e612b45a4101406daa1aace4de3daec448bd0 100644 |
--- a/pkg/unittest/lib/unittest.dart |
+++ b/pkg/unittest/lib/unittest.dart |
@@ -390,7 +390,7 @@ class _SpreadArgsHelper { |
invoke([arg0 = sentinel, arg1 = sentinel, arg2 = sentinel, |
arg3 = sentinel, arg4 = sentinel]) { |
- return guardAsync(() { |
+ return _guardAsync(() { |
if (!shouldCallBack()) { |
return; |
} else if (arg0 == sentinel) { |
@@ -414,7 +414,7 @@ class _SpreadArgsHelper { |
} |
invoke0() { |
- return guardAsync( |
+ return _guardAsync( |
() { |
if (shouldCallBack()) { |
return callback(); |
@@ -424,7 +424,7 @@ class _SpreadArgsHelper { |
} |
invoke1(arg1) { |
- return guardAsync( |
+ return _guardAsync( |
() { |
if (shouldCallBack()) { |
return callback(arg1); |
@@ -434,7 +434,7 @@ class _SpreadArgsHelper { |
} |
invoke2(arg1, arg2) { |
- return guardAsync( |
+ return _guardAsync( |
() { |
if (shouldCallBack()) { |
return callback(arg1, arg2); |
@@ -723,8 +723,12 @@ void runTests() { |
* |
* The value returned by [tryBody] (if any) is returned by [guardAsync]. |
*/ |
-guardAsync(Function tryBody, [Function finallyBody, int testNum = -1]) { |
- if (testNum < 0) testNum = _currentTest; |
+guardAsync(Function tryBody) { |
+ return _guardAsync(tryBody, null, _currentTest); |
+} |
+ |
+_guardAsync(Function tryBody, Function finallyBody, int testNum) { |
+ assert(testNum >= 0); |
try { |
return tryBody(); |
} catch (e, trace) { |
@@ -766,7 +770,7 @@ _nextBatch() { |
break; |
} |
final testCase = _tests[_currentTest]; |
- var f = guardAsync(testCase.run, null, _currentTest); |
+ var f = _guardAsync(testCase.run, null, _currentTest); |
if (f != null) { |
f.whenComplete(() { |
_nextTestCase(); // Schedule the next test. |