Chromium Code Reviews| Index: lib/src/runner/configuration.dart |
| diff --git a/lib/src/runner/configuration.dart b/lib/src/runner/configuration.dart |
| index bb28aeb87c926a81351280e218c615abd5278ca4..9dd233d6892b793c3891c610da8e4e2230c1813f 100644 |
| --- a/lib/src/runner/configuration.dart |
| +++ b/lib/src/runner/configuration.dart |
| @@ -78,9 +78,25 @@ 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, |
| + help: 'Same as --tags', |
|
nweiz
2015/11/16 21:59:44
There's no need for help on a hidden option.
yjbanov
2015/11/26 06:30:27
Done.
|
| + allowMultiple: true, |
| + splitCommas: true); |
| + parser.addOption("exclude-tags", |
| + abbr: 'e', |
|
nweiz
2015/11/16 21:59:44
Let's make this "x".
yjbanov
2015/11/26 06:30:27
Done.
|
| + help: 'Comma-separated list of tags not to run', |
| + allowMultiple: true, |
| + splitCommas: true); |
| + parser.addOption("exclude-tag", |
| + hide: true, |
| + help: 'Same as --exclude-tag', |
| + allowMultiple: true, |
| + splitCommas: true); |
| return parser; |
| })(); |
| @@ -135,7 +151,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 +181,28 @@ class Configuration { |
| pattern = options['plain-name']; |
| } |
| + var tags = new Set<String>(); |
| + if (options['tags'] != null) { |
| + tags.addAll(options['tags']); |
| + } |
| + if (options['tag'] != null) { |
| + tags.addAll(options['tag']); |
| + } |
| + |
| + var excludeTags = new Set<String>(); |
| + if (options['exclude-tags'] != null) { |
| + excludeTags.addAll(options['exclude-tags']); |
| + } |
| + if (options['exclude-tag'] != null) { |
| + excludeTags.addAll(options['exclude-tag']); |
|
nweiz
2015/11/16 21:59:44
It's safe to use ?? here, which should clean this
yjbanov
2015/11/26 06:30:27
Done.
|
| + } |
| + |
| + 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 +218,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 +242,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 +258,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; |
| } |