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

Unified Diff: pkg/unittest/test/test_utils.dart

Issue 11821039: More fixes to unittest (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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/test/matchers_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/test/test_utils.dart
diff --git a/pkg/unittest/test/test_utils.dart b/pkg/unittest/test/test_utils.dart
index cdacdfc3d0c2f26bb140e99138bace0506fc2e31..4a7e1ae13e5746c983084741028da7620c296cb6 100644
--- a/pkg/unittest/test/test_utils.dart
+++ b/pkg/unittest/test/test_utils.dart
@@ -21,26 +21,40 @@ void initUtils() {
}
}
-void shouldFail(value, Matcher matcher, expected) {
+void shouldFail(value, Matcher matcher, expected, {bool isAsync: false}) {
configureExpectFailureHandler(_testHandler);
errorCount = 0;
errorString = '';
expect(value, matcher);
- configureExpectFailureHandler(null);
- expect(errorCount, equals(1));
- if (expected is String) {
- expect(errorString, equalsIgnoringWhitespace(expected));
+ afterTest(_) {
+ configureExpectFailureHandler(null);
+ expect(errorCount, equals(1));
+ if (expected is String) {
+ expect(errorString, equalsIgnoringWhitespace(expected));
+ } else {
+ expect(errorString, expected);
+ }
+ }
+
+ if (isAsync) {
+ new Timer(0, expectAsync1(afterTest));
} else {
- expect(errorString, expected);
+ afterTest(null);
}
}
-void shouldPass(value, Matcher matcher) {
+void shouldPass(value, Matcher matcher, {bool isAsync: false}) {
configureExpectFailureHandler(_testHandler);
errorCount = 0;
errorString = '';
expect(value, matcher);
- configureExpectFailureHandler(null);
- expect(errorCount, equals(0));
+ afterTest(_) {
+ configureExpectFailureHandler(null);
+ expect(errorCount, equals(0));
+ }
+ if (isAsync) {
+ new Timer(0, expectAsync1(afterTest));
+ } else {
+ afterTest(null);
+ }
}
-
« no previous file with comments | « pkg/unittest/test/matchers_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698