Skip to content

Commit 673121f

Browse files
committed
Strip command line arguments in case people accidentally invoke with arguments that have spaces left and right.
1 parent 1a11023 commit 673121f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

History.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## [Git master](https://github.com/cucumber/cucumber-jvm/compare/v1.1.1...master)
22

3+
* [Core] Strip command line arguments in case people accidentally invoke `cucumber.api.cli.Main` with arguments that have spaces left and right. (Aslak Hellesøy)
34
* [Core] Implemented `DataTable.equals()` and `DataTable.hashCode()`. (Aslak Hellesøy)
45
* [Core] Support `DataTable.toTable(List<String[]>) and `DataTable.toTable(List<Map<String,String>>)` ([#433](https://github.com/cucumber/cucumber-jvm/issues/433), [#434](https://github.com/cucumber/cucumber-jvm/pull/434) Nicholas Albion, Aslak Hellesøy)
56
* [Core] Formatters and `--dotcucumber` can now write to a file or an URL (via HTTP PUT). This allows easier distribution of reports. (Aslak Hellesøy)

core/src/main/java/cucumber/runtime/RuntimeOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private List<String> cucumberOptionsSplit(String property) {
7373
private void parse(List<String> args) {
7474
List<Object> parsedFilters = new ArrayList<Object>();
7575
while (!args.isEmpty()) {
76-
String arg = args.remove(0);
76+
String arg = args.remove(0).trim();
7777

7878
if (arg.equals("--help") || arg.equals("-h")) {
7979
System.out.println(USAGE);

core/src/test/java/cucumber/runtime/RuntimeOptionsTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public void assigns_feature_paths() {
3030
assertEquals(asList("somewhere_else"), options.featurePaths);
3131
}
3232

33+
@Test
34+
public void strips_options() {
35+
RuntimeOptions options = new RuntimeOptions(new Properties(), " --glue ", "somewhere", "somewhere_else");
36+
assertEquals(asList("somewhere_else"), options.featurePaths);
37+
}
38+
3339
@Test
3440
public void assigns_glue() {
3541
RuntimeOptions options = new RuntimeOptions(new Properties(), "--glue", "somewhere");

0 commit comments

Comments
 (0)