| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 void _printHelp() { | 399 void _printHelp() { |
| 400 print('usage: dart test.dart [options]\n'); | 400 print('usage: dart test.dart [options]\n'); |
| 401 print('Options:\n'); | 401 print('Options:\n'); |
| 402 for (var option in _options) { | 402 for (var option in _options) { |
| 403 print('${option.name}: ${option.description}.'); | 403 print('${option.name}: ${option.description}.'); |
| 404 for (var name in option.keys) { | 404 for (var name in option.keys) { |
| 405 assert(name.startsWith('-')); | 405 assert(name.startsWith('-')); |
| 406 var buffer = new StringBuffer();; | 406 var buffer = new StringBuffer();; |
| 407 buffer.add(name); | 407 buffer.add(name); |
| 408 if (option.type == 'bool') { | 408 if (option.type == 'bool') { |
| 409 assert(option.values.empty()); | 409 assert(option.values.isEmpty()); |
| 410 } else { | 410 } else { |
| 411 buffer.add(name.startsWith('--') ? '=' : ' '); | 411 buffer.add(name.startsWith('--') ? '=' : ' '); |
| 412 if (option.type == 'int') { | 412 if (option.type == 'int') { |
| 413 assert(option.values.empty()); | 413 assert(option.values.isEmpty()); |
| 414 buffer.add('n (default: ${option.defaultValue})'); | 414 buffer.add('n (default: ${option.defaultValue})'); |
| 415 } else { | 415 } else { |
| 416 buffer.add('['); | 416 buffer.add('['); |
| 417 bool first = true; | 417 bool first = true; |
| 418 for (var value in option.values) { | 418 for (var value in option.values) { |
| 419 if (!first) buffer.add(", "); | 419 if (!first) buffer.add(", "); |
| 420 if (value == option.defaultValue) buffer.add('*'); | 420 if (value == option.defaultValue) buffer.add('*'); |
| 421 buffer.add(value); | 421 buffer.add(value); |
| 422 first = false; | 422 first = false; |
| 423 } | 423 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 439 if (option.keys.some((key) => key == name)) { | 439 if (option.keys.some((key) => key == name)) { |
| 440 return option; | 440 return option; |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 return null; | 443 return null; |
| 444 } | 444 } |
| 445 | 445 |
| 446 | 446 |
| 447 List<_TestOptionSpecification> _options; | 447 List<_TestOptionSpecification> _options; |
| 448 } | 448 } |
| OLD | NEW |