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

Unified Diff: lib/src/runner/configuration/args.dart

Issue 1715583003: Use boolean selector syntax for tags. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 10 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
« no previous file with comments | « lib/src/runner/configuration.dart ('k') | lib/src/runner/configuration/load.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/configuration/args.dart
diff --git a/lib/src/runner/configuration/args.dart b/lib/src/runner/configuration/args.dart
index dc8eb14561a6222480c2f80914f0216b108bc07e..8ce1d1fdbeae120c27839ba0ab45e10fbf5c7ec0 100644
--- a/lib/src/runner/configuration/args.dart
+++ b/lib/src/runner/configuration/args.dart
@@ -5,10 +5,10 @@
import 'dart:io';
import 'package:args/args.dart';
+import 'package:boolean_selector/boolean_selector.dart';
import '../../backend/test_platform.dart';
import '../../frontend/timeout.dart';
-import '../../utils.dart';
import '../configuration.dart';
import 'values.dart';
@@ -42,12 +42,14 @@ final ArgParser _parser = (() {
// tags to run. In the shorter term, disallow non-"identifier" tags.
parser.addOption("tags",
abbr: 't',
- help: 'Run only tests with all of the specified tags.',
+ help: 'Run only tests with all of the specified tags.\n'
+ 'Supports boolean selector syntax.',
allowMultiple: true);
parser.addOption("tag", hide: true, allowMultiple: true);
parser.addOption("exclude-tags",
abbr: 'x',
- help: "Don't run tests with any of the specified tags.",
+ help: "Don't run tests with any of the specified tags.\n"
+ "Supports boolean selector syntax.",
allowMultiple: true);
parser.addOption("exclude-tag", hide: true, allowMultiple: true);
@@ -118,22 +120,21 @@ Configuration parse(List<String> args) {
pattern = options['plain-name'];
}
- var tags = new Set();
- tags.addAll(options['tags'] ?? []);
- tags.addAll(options['tag'] ?? []);
-
- var excludeTags = new Set();
- excludeTags.addAll(options['exclude-tags'] ?? []);
- excludeTags.addAll(options['exclude-tag'] ?? []);
-
- var tagIntersection = tags.intersection(excludeTags);
- if (tagIntersection.isNotEmpty) {
- throw new FormatException(
- 'The ${pluralize('tag', tagIntersection.length)} '
- '${toSentence(tagIntersection)} '
- '${pluralize('was', tagIntersection.length, plural: 'were')} '
- 'both included and excluded.');
- }
+ var includeTagSet = new Set.from(options['tags'] ?? [])
+ ..addAll(options['tag'] ?? []);
+
+ var includeTags = includeTagSet.fold(BooleanSelector.all, (selector, tag) {
+ var tagSelector = new BooleanSelector.parse(tag);
+ return selector.intersection(tagSelector);
+ });
+
+ var excludeTagSet = new Set.from(options['exclude-tags'] ?? [])
+ ..addAll(options['exclude-tag'] ?? []);
+
+ var excludeTags = excludeTagSet.fold(BooleanSelector.none, (selector, tag) {
+ var tagSelector = new BooleanSelector.parse(tag);
+ return selector.union(tagSelector);
+ });
// If the user hasn't explicitly chosen a value, we want to pass null values
// to [new Configuration] so that it considers those fields unset when merging
@@ -156,7 +157,7 @@ Configuration parse(List<String> args) {
pattern: pattern,
platforms: ifParsed('platform')?.map(TestPlatform.find),
paths: options.rest.isEmpty ? null : options.rest,
- includeTags: tags,
+ includeTags: includeTags,
excludeTags: excludeTags);
}
« no previous file with comments | « lib/src/runner/configuration.dart ('k') | lib/src/runner/configuration/load.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698