OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #import("dart:io"); | 7 #import("dart:io"); |
8 #import("dart:math"); | 8 #import("dart:math"); |
9 #import("drt_updater.dart"); | 9 #import("drt_updater.dart"); |
10 #import("test_suite.dart"); | 10 #import("test_suite.dart"); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // Parse the value for the option. | 339 // Parse the value for the option. |
340 if (spec.type == 'bool') { | 340 if (spec.type == 'bool') { |
341 if (!value.isEmpty()) { | 341 if (!value.isEmpty()) { |
342 print('No value expected for bool option $name'); | 342 print('No value expected for bool option $name'); |
343 exit(1); | 343 exit(1); |
344 } | 344 } |
345 configuration[spec.name] = true; | 345 configuration[spec.name] = true; |
346 } else if (spec.type == 'int') { | 346 } else if (spec.type == 'int') { |
347 try { | 347 try { |
348 configuration[spec.name] = parseInt(value); | 348 configuration[spec.name] = parseInt(value); |
349 } catch (var e) { | 349 } catch (e) { |
350 print('Integer value expected for int option $name'); | 350 print('Integer value expected for int option $name'); |
351 exit(1); | 351 exit(1); |
352 } | 352 } |
353 } else { | 353 } else { |
354 assert(spec.type == 'string'); | 354 assert(spec.type == 'string'); |
355 if (!spec.values.isEmpty()) { | 355 if (!spec.values.isEmpty()) { |
356 for (var v in value.split(',')) { | 356 for (var v in value.split(',')) { |
357 if (spec.values.lastIndexOf(v) == -1) { | 357 if (spec.values.lastIndexOf(v) == -1) { |
358 print('Unknown value ($v) for option $name'); | 358 print('Unknown value ($v) for option $name'); |
359 exit(1); | 359 exit(1); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 return option; | 633 return option; |
634 } | 634 } |
635 } | 635 } |
636 print('Unknown test option $name'); | 636 print('Unknown test option $name'); |
637 exit(1); | 637 exit(1); |
638 } | 638 } |
639 | 639 |
640 | 640 |
641 List<_TestOptionSpecification> _options; | 641 List<_TestOptionSpecification> _options; |
642 } | 642 } |
OLD | NEW |