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

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: added test 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..d61d2fa99ea752e4f2fd71778e340393fc64381b 100644
--- a/pkg/scheduled_test/test/metatest.dart
+++ b/pkg/scheduled_test/test/metatest.dart
@@ -53,6 +53,32 @@ 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.
nweiz 2014/04/08 19:27:36 One-sentence first paragraph.
kevmoo 2014/04/08 20:17:51 Done.
+///
+/// All tests must have an expected result in [expectedResults].
+void expectTests(String description, void body(),
+ Map<String, String> expectedResults) {
nweiz 2014/04/08 19:27:36 This never calls [_summarizeTests], which means th
kevmoo 2014/04/08 20:17:51 I added _summarizeTests to each reason: output, wh
+
nweiz 2014/04/08 19:27:36 Nit: unnecessary newline.
kevmoo 2014/04/08 20:17:51 Done.
+ _setUpTest(description, body, (results) {
+ expectedResults = new Map.from(expectedResults);
+
+ for (var t in results['results']) {
nweiz 2014/04/08 19:27:36 Nit: Use actual words for variables, not single ch
kevmoo 2014/04/08 20:17:51 Done.
+ var description = t['description'];
+
+ var expectedResult = expectedResults.remove(description);
+ expect(expectedResult, isNotNull,
+ reason: '"$description" did not have an expected result set.');
nweiz 2014/04/08 19:27:36 Instead of this, use `expect(expectedResults, cont
kevmoo 2014/04/08 20:17:51 Done.
+
+ var result = t['result'];
+
+ expect(result, expectedResult,
+ reason: 'The test "$description" not not have the expected result.');
nweiz 2014/04/08 19:27:36 expect(t, containsPair('result', expectedResult))
kevmoo 2014/04/08 20:17:51 Done.
+ }
+ expect(expectedResults, isEmpty);
nweiz 2014/04/08 19:27:36 reason: "Unexpected additional test results."
kevmoo 2014/04/08 20:17:51 Done.
+ });
+}
+
+/// 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.
void expectTestsFail(String description, void body()) {

Powered by Google App Engine
This is Rietveld 408576698