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

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

Issue 227193002: pkg/scheduled_test: handle null currentSchedule due to timeout (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nits Created 6 years, 8 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
Index: pkg/scheduled_test/test/metatest.dart
diff --git a/pkg/scheduled_test/test/metatest.dart b/pkg/scheduled_test/test/metatest.dart
index 13c5a1d743cf493886266e498d4f568132527215..7550a20c2c2e971e5a8594c9834d8410a5b4029e 100644
--- a/pkg/scheduled_test/test/metatest.dart
+++ b/pkg/scheduled_test/test/metatest.dart
@@ -52,6 +52,38 @@ void expectTestsPass(String description, void body(), {List<String> passing}) {
});
}
+/// Declares a test with the given [description] and [body].
+///
+/// [body] corresponds
+/// to the `main` method of a test file, and will be run in an isolate.
+///
+/// All tests must have an expected result in [expectedResults].
+void expectTests(String description, void body(),
+ Map<String, String> expectedResults) {
+ _setUpTest(description, body, (results) {
+ expectedResults = new Map.from(expectedResults);
+
+ for (var testResult in results['results']) {
+ var description = testResult['description'];
+
+ expect(expectedResults, contains(description),
+ reason: '"$description" did not have an expected result set.\n'
+ '${_summarizeTests(results)}');
+
+ var result = testResult['result'];
+
+ expect(expectedResults, containsPair(description, result),
+ reason: 'The test "$description" not not have the expected result.\n'
+ '${_summarizeTests(results)}');
+
+ expectedResults.remove(description);
+ }
+ expect(expectedResults, isEmpty,
+ reason: 'Unexpected additional test results\n'
+ '${_summarizeTests(results)}');
+ });
+}
+
/// Declares a test with the given [description] and [body]. [body] corresponds
/// to the `main` method of a test file, and will be run in an isolate. Expects
/// all tests defined by [body] to fail.

Powered by Google App Engine
This is Rietveld 408576698