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

Unified Diff: tools/testing/dart/test_options.dart

Issue 8772007: Allow single-dash options to be specified without a space before value. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update a couple of comment.s Created 9 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
Index: tools/testing/dart/test_options.dart
diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart
index aa8744f1610b4ea04e3c07d5e3fb0675604d7b6c..6a77b70f6427658fec8c7869606861dad87d5129 100644
--- a/tools/testing/dart/test_options.dart
+++ b/tools/testing/dart/test_options.dart
@@ -140,19 +140,24 @@ class TestOptionsParser {
_printHelp();
return null;
}
- name = arg;
- if ((i + 1) >= arguments.length) {
- print('No value supplied for option $name');
- return null;
+ if (arg.length > 2) {
+ name = arg.substring(0, 2);
+ value = arg.substring(2, arg.length);
+ } else {
+ name = arg;
+ if ((i + 1) >= arguments.length) {
+ print('No value supplied for option $name');
+ return null;
+ }
+ value = arguments[++i];
}
- value = arguments[++i];
} else {
// The argument does not start with '-' or '--' and is
// therefore not an option. We use it as a test selection
// pattern.
- var patterns = configuration['patterns'];
+ var patterns = configuration['selectors'];
if (patterns == null) {
Bill Hesse 2011/12/02 10:21:05 This is exactly var patterns = configuration.putIf
Mads Ager (google) 2011/12/02 10:36:53 Done.
- configuration['patterns'] = patterns = new List();
+ configuration['selectors'] = patterns = new List();
}
patterns.add(arg);
continue;
@@ -221,20 +226,30 @@ class TestOptionsParser {
// expect.
configuration['unchecked'] = !configuration['checked'];
- // Expand the test selectors into simple regular expressions to be
- // used on the full path of a test file. If no selectors are
- // explicitly given use the default suite patterns.
- List patterns = configuration['patterns'];
- if (patterns == null) {
- patterns = new List.from(defaultTestSelectors);
- }
- for (var i = 0; i < patterns.length; i++) {
- if (patterns[i] is RegExp) continue;
- patterns[i] = patterns[i].replaceAll('*', '.*');
- patterns[i] = patterns[i].replaceAll('/', '.*');
- patterns[i] = new RegExp(patterns[i]);
+ // Expand the test selectors into a suite name and a simple
+ // regular expressions to be used on the full path of a test file
+ // in that test suite. If no selectors are explicitly given use
+ // the default suite patterns.
+ List selectors = configuration['selectors'];
Bill Hesse 2011/12/02 10:21:05 If selectors will sometimes be a Map, this should
Mads Ager (google) 2011/12/02 10:36:53 Thanks! Done.
+ if (selectors is !Map) {
+ if (selectors == null) {
+ selectors = new List.from(defaultTestSelectors);
+ }
+ Map<String, RegExp> selectorMap = new Map<String, RegExp>();
+ for (var i = 0; i < selectors.length; i++) {
+ var pattern = selectors[i];
+ var suite = pattern;
+ var slashLocation = pattern.indexOf('/');
+ if (slashLocation != -1) {
+ suite = pattern.substring(0, slashLocation);
+ pattern = pattern.substring(slashLocation + 1);
+ }
+ pattern = pattern.replaceAll('*', '.*');
+ pattern = pattern.replaceAll('/', '.*');
Bill Hesse 2011/12/02 10:21:05 At least the "replaceAll('/'..." can go inside the
Mads Ager (google) 2011/12/02 10:36:53 Yes, the first component has to be a suite name an
+ selectorMap[suite] = new RegExp(pattern);
+ }
+ configuration['selectors'] = selectorMap;
}
- configuration['patterns'] = patterns;
// Expand the architectures.
var archs = configuration['architecture'];

Powered by Google App Engine
This is Rietveld 408576698