From d8d9bb56137b25540f7683e8f40f1aa35239b494 Mon Sep 17 00:00:00 2001 From: Jens Johansen Date: Mon, 20 Nov 2017 11:35:57 +0000 Subject: [PATCH] [pkg testing] Fix off-by-one in cmdline parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Commit-Queue: Jens Johansen --- pkg/testing/lib/src/run_tests.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/testing/lib/src/run_tests.dart b/pkg/testing/lib/src/run_tests.dart index 165dbcd070e..d1860a11204 100644 --- a/pkg/testing/lib/src/run_tests.dart +++ b/pkg/testing/lib/src/run_tests.dart @@ -123,7 +123,7 @@ class CommandLine { int index = arguments.indexOf("--"); Set options; if (index != -1) { - options = new Set.from(arguments.getRange(0, index - 1)); + options = new Set.from(arguments.getRange(0, index)); arguments = arguments.sublist(index + 1); } else { options = arguments.where((argument) => argument.startsWith("-")).toSet();