Chromium Code Reviews| Index: test/runner/runner_test.dart |
| diff --git a/test/runner/runner_test.dart b/test/runner/runner_test.dart |
| index 508b7fa65b41eac369e3d02c2a7e9240c386b44e..ee1059afef79a162a1c89d2132729bf92844516f 100644 |
| --- a/test/runner/runner_test.dart |
| +++ b/test/runner/runner_test.dart |
| @@ -672,4 +672,94 @@ void main() { |
| }); |
| }); |
| }); |
| + |
| + group("tags", () { |
|
nweiz
2015/11/03 00:43:16
I'm trying to keep runner_test.dart from getting m
yjbanov
2015/11/11 06:40:20
Done.
|
| + test("runs only tests containing specified tags", () { |
| + d.file("test.dart", """ |
| +import 'package:test/test.dart'; |
| + |
| +void main() { |
| + test("no tags", () {}); |
| + test("a", () {}, tags: "a"); |
| + test("b", () {}, tags: "b"); |
| + test("bc", () {}, tags: "b,c"); |
| +} |
| +""").create(); |
| + |
| + var test; |
| + |
| + /// [warnings] contains pairs, each containing a comma-separated list of |
| + /// tags the warning is about and the test name. |
| + expectTagWarnings(List<List<String>> warnings) { |
| + for (var warning in warnings) { |
| + test.stderr.expect(consumeThrough(contains( |
| + "WARNING: unrecognized tags {${warning[0]}}" |
| + " in test '${warning[1]}'"))); |
| + } |
| + test.stderr.expect(isDone); |
| + } |
| + |
| + test = runTest(["test.dart"]); |
| + test.stdout.expect(consumeThrough(contains("+4: All tests passed!"))); |
| + expectTagWarnings([ |
| + ['a', 'a'], |
| + ['b', 'b'], |
| + ['b, c', 'bc'], |
| + ]); |
| + test.shouldExit(0); |
| + |
| + test = runTest(["--tags=a", "test.dart"]); |
| + test.stdout.expect(consumeThrough(contains("+1: All tests passed!"))); |
| + expectTagWarnings([ |
| + ['b', 'b'], |
| + ['b, c', 'bc'], |
| + ]); |
| + test.shouldExit(0); |
| + |
| + test = runTest(["--tags=b", "test.dart"]); |
| + test.stdout.expect(consumeThrough(contains("+2: All tests passed!"))); |
| + expectTagWarnings([ |
| + ['a', 'a'], |
| + ['c', 'bc'], |
| + ]); |
| + test.shouldExit(0); |
| + |
| + test = runTest(["--tags=c", "test.dart"]); |
| + test.stdout.expect(consumeThrough(contains("+1: All tests passed!"))); |
| + expectTagWarnings([ |
| + ['a', 'a'], |
| + ['b', 'b'], |
| + ['b', 'bc'], |
| + ]); |
| + test.shouldExit(0); |
| + |
| + test = runTest(["--tags=a,b,c", "test.dart"]); |
| + test.stdout.expect(consumeThrough(contains("+3: All tests passed!"))); |
| + expectTagWarnings([]); |
| + test.shouldExit(0); |
| + }); |
| + |
| + test("takes -t abbreviation and --tag typo", () { |
| + d.file("test.dart", """ |
| +import 'package:test/test.dart'; |
| + |
| +void main() { |
| + test("no tags", () {}); |
| + test("a", () {}, tags: "a"); |
| +} |
| +""").create(); |
| + |
| + var test = runTest(["test.dart"]); |
| + test.stdout.expect(consumeThrough(contains("+2: All tests passed!"))); |
| + test.shouldExit(0); |
| + |
| + test = runTest(["-t", "a", "test.dart"]); |
| + test.stdout.expect(consumeThrough(contains("+1: All tests passed!"))); |
| + test.shouldExit(0); |
| + |
| + test = runTest(["--tag=a", "test.dart"]); |
| + test.stdout.expect(consumeThrough(contains("+1: All tests passed!"))); |
| + test.shouldExit(0); |
| + }); |
| + }); |
| } |