Skip to content

Commit fe5fd7e

Browse files
author
Robert James Oxspring
committed
Added test to demonstrate fix of 19383
BR: 19383 git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@130114 13f79535-47bb-0310-9956-ffa450edef68
1 parent 9cb37e0 commit fe5fd7e

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,5 +514,23 @@ public void test21215() {
514514
"Footer"+SEP
515515
,out.toString());
516516
}
517+
518+
public void test19383() {
519+
Options options = new Options();
520+
options.addOption(new Option("a","aaa",false,"aaaaaaa"));
521+
options.addOption(new Option(null,"bbb",false,"bbbbbbb"));
522+
options.addOption(new Option("c",null,false,"ccccccc"));
523+
524+
HelpFormatter formatter = new HelpFormatter();
525+
String SEP = System.getProperty("line.separator");
526+
StringWriter out = new StringWriter();
527+
formatter.printHelp(new PrintWriter(out),80, "foobar", "", options, 2, 2, "", true);
528+
assertEquals(
529+
"usage: foobar [-a] [-c] [--bbb]"+SEP+
530+
" -a,--aaa aaaaaaa"+SEP+
531+
" --bbb bbbbbbb"+SEP+
532+
" -c ccccccc"+SEP
533+
,out.toString());
534+
}
517535

518536
}

0 commit comments

Comments
 (0)