Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library("test_options_parser"); | 5 #library("test_options_parser"); |
| 6 | 6 |
| 7 List<String> defaultTestSelectors = const ['standalone', 'corelib', 'co19']; | 7 List<String> defaultTestSelectors = const ['standalone', 'corelib', 'co19']; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Specification of a single test option. | 10 * Specification of a single test option. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 _printHelp(); | 138 _printHelp(); |
| 139 return null; | 139 return null; |
| 140 } | 140 } |
| 141 name = arg; | 141 name = arg; |
| 142 if ((i + 1) >= arguments.length) { | 142 if ((i + 1) >= arguments.length) { |
| 143 print('No value supplied for option $name'); | 143 print('No value supplied for option $name'); |
| 144 return null; | 144 return null; |
| 145 } | 145 } |
| 146 value = arguments[++i]; | 146 value = arguments[++i]; |
| 147 } else { | 147 } else { |
| 148 // The option name does not start with '-' or '--' so we | 148 // The argument does not start with '-' or '--' and is |
| 149 // assume that the rest of the arguments specify tests or test | 149 // therefore not an option. We use it as a test selection |
| 150 // suites to run. | 150 // pattern. |
| 151 configuration['patterns'] = arguments.getRange(i, numArguments - i); | 151 var patterns = configuration['patterns']; |
| 152 return _expandConfigurations(configuration); | 152 if (patterns == null) { |
| 153 configuration['patterns'] = patterns = new List(); | |
| 154 } | |
| 155 patterns.add(arg); | |
| 156 continue; | |
|
Bill Hesse
2011/11/17 09:17:53
Nice. I was thinking that it is annoying not to a
| |
| 153 } | 157 } |
| 154 // Find the option specification for the name. | 158 // Find the option specification for the name. |
| 155 var spec = _getSpecification(name); | 159 var spec = _getSpecification(name); |
| 156 if (spec == null) { | 160 if (spec == null) { |
| 157 print('Unknown test option $name'); | 161 print('Unknown test option $name'); |
| 158 return null; | 162 return null; |
| 159 } | 163 } |
| 160 // Parse the value for the option. | 164 // Parse the value for the option. |
| 161 if (spec.type == 'bool') { | 165 if (spec.type == 'bool') { |
| 162 if (!value.isEmpty()) { | 166 if (!value.isEmpty()) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 configuration['unchecked'] = !configuration['checked']; | 212 configuration['unchecked'] = !configuration['checked']; |
| 209 | 213 |
| 210 // Expand the test selectors into simple regular expressions to be | 214 // Expand the test selectors into simple regular expressions to be |
| 211 // used on the full path of a test file. If no selectors are | 215 // used on the full path of a test file. If no selectors are |
| 212 // explicitly given use the default suite patterns. | 216 // explicitly given use the default suite patterns. |
| 213 List patterns = configuration['patterns']; | 217 List patterns = configuration['patterns']; |
| 214 if (patterns == null) { | 218 if (patterns == null) { |
| 215 patterns = new List.from(defaultTestSelectors); | 219 patterns = new List.from(defaultTestSelectors); |
| 216 } | 220 } |
| 217 for (var i = 0; i < patterns.length; i++) { | 221 for (var i = 0; i < patterns.length; i++) { |
| 222 if (patterns[i] is RegExp) continue; | |
| 218 patterns[i] = patterns[i].replaceAll('*', '.*'); | 223 patterns[i] = patterns[i].replaceAll('*', '.*'); |
| 219 patterns[i] = patterns[i].replaceAll('/', '.*'); | 224 patterns[i] = patterns[i].replaceAll('/', '.*'); |
| 220 patterns[i] = new RegExp(patterns[i]); | 225 patterns[i] = new RegExp(patterns[i]); |
| 221 } | 226 } |
| 222 configuration['patterns'] = patterns; | 227 configuration['patterns'] = patterns; |
| 223 | 228 |
| 224 // Expand the architectures. | 229 // Expand the architectures. |
| 225 var archs = configuration['architecture']; | 230 var archs = configuration['architecture']; |
| 226 if (archs.contains(',')) { | 231 if (archs.contains(',')) { |
| 227 var result = new List<Map>(); | 232 var result = new List<Map>(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 if (option.keys.some((key) => key == name)) { | 331 if (option.keys.some((key) => key == name)) { |
| 327 return option; | 332 return option; |
| 328 } | 333 } |
| 329 } | 334 } |
| 330 return null; | 335 return null; |
| 331 } | 336 } |
| 332 | 337 |
| 333 | 338 |
| 334 List<_TestOptionSpecification> _options; | 339 List<_TestOptionSpecification> _options; |
| 335 } | 340 } |
| OLD | NEW |