| 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 = | 7 List<String> defaultTestSelectors = |
| 8 const ['dartc', 'samples', 'standalone', 'corelib', 'co19', 'language', | 8 const ['dartc', 'samples', 'standalone', 'corelib', 'co19', 'language', |
| 9 'isolate', 'stub-generator', 'vm', 'client']; | 9 'isolate', 'stub-generator', 'vm', 'client']; |
| 10 | 10 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 var name = ''; | 177 var name = ''; |
| 178 var value = ''; | 178 var value = ''; |
| 179 if (arg.startsWith('--')) { | 179 if (arg.startsWith('--')) { |
| 180 if (arg == '--help') { | 180 if (arg == '--help') { |
| 181 _printHelp(); | 181 _printHelp(); |
| 182 return null; | 182 return null; |
| 183 } | 183 } |
| 184 var split = arg.lastIndexOf('='); | 184 var split = arg.lastIndexOf('='); |
| 185 if (split == -1) { | 185 if (split == -1) { |
| 186 name = arg; | 186 name = arg; |
| 187 value = ''; | 187 // Boolean options do not have a value. |
| 188 if (_getSpecification(name).type != 'bool') { |
| 189 if ((i + 1) >= arguments.length) { |
| 190 print('No value supplied for option $name'); |
| 191 return null; |
| 192 } |
| 193 value = arguments[++i]; |
| 194 } |
| 188 } else { | 195 } else { |
| 189 name = arg.substring(0, split); | 196 name = arg.substring(0, split); |
| 190 value = arg.substring(split + 1, arg.length); | 197 value = arg.substring(split + 1, arg.length); |
| 191 } | 198 } |
| 192 } else if (arg.startsWith('-')) { | 199 } else if (arg.startsWith('-')) { |
| 193 if (arg == '-h') { | 200 if (arg == '-h') { |
| 194 _printHelp(); | 201 _printHelp(); |
| 195 return null; | 202 return null; |
| 196 } | 203 } |
| 197 if (arg.length > 2) { | 204 if (arg.length > 2) { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 if (option.keys.some((key) => key == name)) { | 439 if (option.keys.some((key) => key == name)) { |
| 433 return option; | 440 return option; |
| 434 } | 441 } |
| 435 } | 442 } |
| 436 return null; | 443 return null; |
| 437 } | 444 } |
| 438 | 445 |
| 439 | 446 |
| 440 List<_TestOptionSpecification> _options; | 447 List<_TestOptionSpecification> _options; |
| 441 } | 448 } |
| OLD | NEW |