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); |
+ } |
} |
- |