Added option to test which traverses extra if-path
Project: http://git-wip-us.apache.org/repos/asf/commons-cli/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-cli/commit/3d9587ca Tree: http://git-wip-us.apache.org/repos/asf/commons-cli/tree/3d9587ca Diff: http://git-wip-us.apache.org/repos/asf/commons-cli/diff/3d9587ca Branch: refs/heads/master Commit: 3d9587caec7dd23d359bc112c63512e2bc3e0702 Parents: 4f17a89 Author: Rubin Simons <ru...@raaftech.com> Authored: Tue Jun 27 18:46:37 2017 +0200 Committer: Rubin Simons <ru...@raaftech.com> Committed: Tue Jun 27 18:46:37 2017 +0200 ---------------------------------------------------------------------- .../org/apache/commons/cli/DisablePartialMatchingTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-cli/blob/3d9587ca/src/test/java/org/apache/commons/cli/DisablePartialMatchingTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/cli/DisablePartialMatchingTest.java b/src/test/java/org/apache/commons/cli/DisablePartialMatchingTest.java index 0457bac..b9cb79e 100644 --- a/src/test/java/org/apache/commons/cli/DisablePartialMatchingTest.java +++ b/src/test/java/org/apache/commons/cli/DisablePartialMatchingTest.java @@ -33,11 +33,13 @@ public class DisablePartialMatchingTest options.addOption(new Option("d", "debug", false, "Turn on debug.")); options.addOption(new Option("e", "extract", false, "Turn on extract.")); + options.addOption(new Option("o", "option", true, "Turn on option with argument.")); - CommandLine line = parser.parse(options, new String[]{"-de"}); + CommandLine line = parser.parse(options, new String[]{"-de", "--option=foobar"}); assertTrue("There should be an option debug in any case...", line.hasOption("debug")); assertTrue("There should be an extract option because partial matching is off", line.hasOption("extract")); + assertTrue("There should be an option option with a argument value", line.hasOption("option")); } @Test @@ -49,10 +51,13 @@ public class DisablePartialMatchingTest options.addOption(new Option("d", "debug", false, "Turn on debug.")); options.addOption(new Option("e", "extract", false, "Turn on extract.")); + options.addOption(new Option("o", "option", true, "Turn on option with argument.")); - CommandLine line = parser.parse(options, new String[]{"-de"}); + + CommandLine line = parser.parse(options, new String[]{"-de", "--option=foobar"}); assertTrue("There should be an option debug in any case...", line.hasOption("debug")); assertFalse("There should not be an extract option because partial matching only selects debug", line.hasOption("extract")); + assertTrue("There should be an option option with a argument value", line.hasOption("option")); } }