mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
[pkg testing] Fix off-by-one in cmdline parsing
Running a test via pkg/testing where the command line starts with "--" would throw a RangeError (it's asking for a range from 0 to -1). Having the "--" somewhere in the middle of the arguments list would not throw, but instead "eat" an argument. Bug: Change-Id: Ie13052a378746c17b343dff7704002a6929088bf Reviewed-on: https://dart-review.googlesource.com/21920 Reviewed-by: Peter von der Ahé <ahe@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
parent
0633d0bfc0
commit
d8d9bb5613
|
@ -123,7 +123,7 @@ class CommandLine {
|
|||
int index = arguments.indexOf("--");
|
||||
Set<String> options;
|
||||
if (index != -1) {
|
||||
options = new Set<String>.from(arguments.getRange(0, index - 1));
|
||||
options = new Set<String>.from(arguments.getRange(0, index));
|
||||
arguments = arguments.sublist(index + 1);
|
||||
} else {
|
||||
options = arguments.where((argument) => argument.startsWith("-")).toSet();
|
||||
|
|
Loading…
Reference in a new issue