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

Unified Diff: pkg/scheduled_test/test/utils.dart

Issue 119673002: Add a ScheduledStream class and some stream matchers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 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/scheduled_test/test/scheduled_stream/stream_matcher_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/scheduled_test/test/utils.dart
diff --git a/pkg/scheduled_test/test/utils.dart b/pkg/scheduled_test/test/utils.dart
index 6fc24f341557821ead32f1438ddf373c11a6206a..e2b6fcd7921d899c98b679259282c587f251a60d 100644
--- a/pkg/scheduled_test/test/utils.dart
+++ b/pkg/scheduled_test/test/utils.dart
@@ -58,3 +58,33 @@ void setUpTimeout() {
currentSchedule.timeout = new Duration(seconds: 10);
});
}
+
+/// Creates a metatest with [body] and asserts that it passes.
+///
+/// This is like [expectTestsPass], but the [test] is set up automatically.
+void expectTestPasses(String description, void body()) =>
+ expectTestsPass(description, () => test('test', body));
+
+/// Creates a metatest that runs [testBody], captures its schedule errors, and
+/// passes them to [validator].
+///
+/// [testBody] is expected to produce an error, while [validator] is expected to
+/// produce none.
+void expectTestFails(String description, void testBody(),
+ void validator(List<ScheduleError> errors)) {
+ expectTestsPass(description, () {
+ var errors;
+ test('test body', () {
+ currentSchedule.onException.schedule(() {
+ errors = currentSchedule.errors;
+ });
+
+ testBody();
+ });
+
+ test('validate errors', () {
+ expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
+ validator(errors);
+ });
+ }, passing: ['validate errors']);
+}
« no previous file with comments | « pkg/scheduled_test/test/scheduled_stream/stream_matcher_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698