Chromium Code Reviews| 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()) { |