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

Unified Diff: test/runner/runner_test.dart

Issue 1405633004: feature: tag tests; choose tags on command line Base URL: git@github.com:yjbanov/test.git@tags
Patch Set: address review comments Created 5 years, 2 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
« lib/src/backend/metadata.dart ('K') | « test/backend/metadata_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ });
+ });
}
« lib/src/backend/metadata.dart ('K') | « test/backend/metadata_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698