Skip to content

Commit

Permalink
#571 add Interpreter.consumedCountMap test
Browse files Browse the repository at this point in the history
  • Loading branch information
remkop committed Jan 1, 2019
1 parent 6ab58f3 commit 03a96f8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/java/picocli/CommandLineArityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,19 @@ class ValSepC {
ValSepC val3a = parseCommonsCliCompatible(new ValSepC(), "-b1,2,3".split(" "));
assertArrayEquals(new String[]{"1", "2,3"}, val3a.b);
}

@Test
public void testCommonsCliCompatibleSeparatorHandlingForMaps() {
class ValSepC {
@Option(names = "-b", arity="1..2", split=",") Map<String, String> b;
}
ValSepC val3a = parseCommonsCliCompatible(new ValSepC(), "-ba=1,b=2,c=3".split(" "));
Map<String, String> expected = new LinkedHashMap<String, String>();
expected.put("a", "1");
expected.put("b", "2,c=3");
assertEquals(expected, val3a.b);
}

private <T> T parseCommonsCliCompatible(T obj, String[] args) {
CommandLine cmd = new CommandLine(obj);
cmd.getCommandSpec().parser()
Expand Down

0 comments on commit 03a96f8

Please sign in to comment.