Skip to content

Commit 3fd1eb0

Browse files
author
John Keyes
committed
added test for 15046
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@129869 13f79535-47bb-0310-9956-ffa450edef68
1 parent 582aa70 commit 3fd1eb0

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/test/org/apache/commons/cli/BugsTest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* version 1.1, a copy of which has been included with this distribution in
66
* the LICENSE file.
77
*
8-
* $Id: BugsTest.java,v 1.12 2002/11/25 23:43:41 jkeyes Exp $
8+
* $Id: BugsTest.java,v 1.13 2003/01/13 08:17:26 jkeyes Exp $
99
*/
1010

1111
package org.apache.commons.cli;
@@ -361,4 +361,20 @@ public void test14786() {
361361
}
362362
}
363363

364+
public void test15046() throws Exception {
365+
CommandLineParser parser = new PosixParser();
366+
final String[] CLI_ARGS = new String[] {"-z", "c"};
367+
Option option = new Option("z", "timezone", true,
368+
"affected option");
369+
Options cliOptions = new Options();
370+
cliOptions.addOption(option);
371+
parser.parse(cliOptions, CLI_ARGS);
372+
373+
//now add conflicting option
374+
cliOptions.addOption("c", "conflict", true, "conflict option");
375+
CommandLine line = parser.parse(cliOptions, CLI_ARGS);
376+
assertEquals( option.getValue(), "c" );
377+
assertTrue( !line.hasOption("c") );
378+
}
379+
364380
}

0 commit comments

Comments
 (0)