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

Unified Diff: lib/src/runner.dart

Issue 1405633004: feature: tag tests; choose tags on command line Base URL: git@github.com:yjbanov/test.git@tags
Patch Set: address comments Created 5 years, 1 month 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
« no previous file with comments | « lib/src/frontend/tags.dart ('k') | lib/src/runner/configuration.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner.dart
diff --git a/lib/src/runner.dart b/lib/src/runner.dart
index 260c3106951badc31a575aaecf285d2af02b05eb..90027ddbb17b70c0a6b365e521e79572ae19d379 100644
--- a/lib/src/runner.dart
+++ b/lib/src/runner.dart
@@ -158,9 +158,23 @@ class Runner {
]);
})).map((loadSuite) {
return loadSuite.changeSuite((suite) {
- return suite.filter((test) =>
- (_config.pattern == null || test.name.contains(_config.pattern)) &&
- (_config.tags.isEmpty || intersect(_config.tags, test.metadata.tags)));
+ return suite.filter((test) {
+ bool matchesNamePattern =
+ _config.pattern == null || test.name.contains(_config.pattern);
+ bool matchesTags = _config.tags.isEmpty ||
+ intersect(_config.tags, test.metadata.tags);
+ bool matchesExcludeTags =
+ intersect(_config.excludeTags, test.metadata.tags);
+
+ var specifiedTags = _config.tags.union(_config.excludeTags);
+ List unrecognizedTags = test.metadata.tags.difference(specifiedTags);
+ if (unrecognizedTags.isNotEmpty) {
+ var yellow = _config.color ? '\u001b[33m' : '';
+ stderr.writeln("\n${yellow}WARNING: unrecognized tags ${unrecognizedTags} in test '${test.name}'");
+ }
+
+ return matchesNamePattern && matchesTags && !matchesExcludeTags;
+ });
});
});
}
« no previous file with comments | « lib/src/frontend/tags.dart ('k') | lib/src/runner/configuration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698