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

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

Issue 638433003: Adding a reason field to expectAsync and expectAsyncUntil (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merging master Created 6 years, 2 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
« no previous file with comments | « pkg/unittest/CHANGELOG.md ('k') | pkg/unittest/lib/unittest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/spread_args_helper.dart
diff --git a/pkg/unittest/lib/src/spread_args_helper.dart b/pkg/unittest/lib/src/spread_args_helper.dart
index 9367201967c3770fc4e2c4f3b1547ab34698c804..554dcf64c458d7111313299959d8c1af3f20a99d 100644
--- a/pkg/unittest/lib/src/spread_args_helper.dart
+++ b/pkg/unittest/lib/src/spread_args_helper.dart
@@ -14,18 +14,20 @@ class _SpreadArgsHelper {
final int maxExpectedCalls;
final Function isDone;
final String id;
+ final String reason;
int actualCalls = 0;
final TestCase testCase;
bool complete;
_SpreadArgsHelper(Function callback, int minExpected, int maxExpected,
- String id, {bool isDone()})
+ String id, String reason, {bool isDone()})
: this.callback = callback,
minExpectedCalls = minExpected,
maxExpectedCalls = (maxExpected == 0 && minExpected > 0)
? minExpected
: maxExpected,
this.isDone = isDone,
+ this.reason = reason == null ? '' : '\n$reason',
this.testCase = currentTestCase,
this.id = _makeCallbackId(id, callback) {
ensureInitialized();
@@ -73,12 +75,12 @@ class _SpreadArgsHelper {
testCase._error(
'Callback ${id}called ($actualCalls) after test case '
'${testCase.description} has already been marked as '
- '${testCase.result}.');
+ '${testCase.result}.$reason');
}
return false;
} else if (maxExpectedCalls >= 0 && actualCalls > maxExpectedCalls) {
throw new TestFailure('Callback ${id}called more times than expected '
- '($maxExpectedCalls).');
+ '($maxExpectedCalls).$reason');
}
return true;
}
« no previous file with comments | « pkg/unittest/CHANGELOG.md ('k') | pkg/unittest/lib/unittest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698