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

Unified Diff: lib/src/runner/configuration.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/runner.dart ('k') | lib/src/runner/parse_metadata.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/configuration.dart
diff --git a/lib/src/runner/configuration.dart b/lib/src/runner/configuration.dart
index bb28aeb87c926a81351280e218c615abd5278ca4..808030f73e88743b8b45f32297946a1c66af6a08 100644
--- a/lib/src/runner/configuration.dart
+++ b/lib/src/runner/configuration.dart
@@ -78,9 +78,23 @@ class Configuration {
parser.addFlag("color", defaultsTo: null,
help: 'Whether to use terminal colors.\n(auto-detected by default)');
parser.addOption("tags",
- help: 'Comma-separated list of tags to run',
- allowMultiple: true,
- splitCommas: true);
+ abbr: 't',
+ help: 'Comma-separated list of tags to run',
+ allowMultiple: true,
+ splitCommas: true);
+ parser.addOption("tag",
+ hide: true,
+ allowMultiple: true,
+ splitCommas: true);
+ parser.addOption("exclude-tags",
+ abbr: 'x',
+ help: 'Comma-separated list of tags not to run',
+ allowMultiple: true,
+ splitCommas: true);
+ parser.addOption("exclude-tag",
+ hide: true,
+ allowMultiple: true,
+ splitCommas: true);
return parser;
})();
@@ -135,7 +149,10 @@ class Configuration {
final List<TestPlatform> platforms;
/// Restricts the set of tests to a set of tags
- final List<String> tags;
+ final Set<String> tags;
+
+ /// Does not run tests with tags from this set
+ final Set<String> excludeTags;
/// The global test metadata derived from this configuration.
Metadata get metadata =>
@@ -162,6 +179,20 @@ class Configuration {
pattern = options['plain-name'];
}
+ var tags = new Set<String>();
+ tags.addAll(options['tags'] ?? []);
+ tags.addAll(options['tag'] ?? []);
+
+ var excludeTags = new Set<String>();
+ excludeTags.addAll(options['exclude-tags'] ?? []);
+ excludeTags.addAll(options['exclude-tag'] ?? []);
+
+ var tagIntersection = tags.intersection(excludeTags);
+ if (tagIntersection.isNotEmpty) {
+ throw new FormatException('Included and excluded tag sets may not'
+ ' intersect. Found intersection: ${tagIntersection.join(', ')}');
+ }
+
return new Configuration(
help: options['help'],
version: options['version'],
@@ -177,7 +208,8 @@ class Configuration {
pattern: pattern,
platforms: options['platform'].map(TestPlatform.find),
paths: options.rest.isEmpty ? null : options.rest,
- tags: options['tags']);
+ tags: tags,
+ excludeTags: excludeTags);
}
/// Runs [parse] on the value of the option [name], and wraps any
@@ -200,7 +232,7 @@ class Configuration {
bool pauseAfterLoad: false, bool color, String packageRoot,
String reporter, int pubServePort, int concurrency, this.pattern,
Iterable<TestPlatform> platforms, Iterable<String> paths,
- List<String> tags})
+ Set<String> tags, Set<String> excludeTags})
: pauseAfterLoad = pauseAfterLoad,
color = color == null ? canUseSpecialChars : color,
packageRoot = packageRoot == null
@@ -216,7 +248,6 @@ class Configuration {
platforms = platforms == null ? [TestPlatform.vm] : platforms.toList(),
paths = paths == null ? ["test"] : paths.toList(),
explicitPaths = paths != null,
- this.tags = tags == null
- ? const <String>[]
- : tags;
+ this.tags = tags,
+ this.excludeTags = excludeTags;
}
« no previous file with comments | « lib/src/runner.dart ('k') | lib/src/runner/parse_metadata.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698