1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.cli2.bug;
18
19 import java.io.PrintWriter;
20 import java.io.StringWriter;
21
22 import org.apache.commons.cli2.Group;
23 import org.apache.commons.cli2.Option;
24 import org.apache.commons.cli2.builder.DefaultOptionBuilder;
25 import org.apache.commons.cli2.builder.GroupBuilder;
26 import org.apache.commons.cli2.util.HelpFormatter;
27
28 import junit.framework.TestCase;
29
30
31
32
33 public class BugCLI18Test extends TestCase {
34
35 public BugCLI18Test() {
36 super();
37 }
38
39
40 public void testBug() {
41 Option a = new DefaultOptionBuilder().withLongName("aaa").withShortName("a").withDescription("aaaaaaa").create();
42 Option b = new DefaultOptionBuilder().withLongName("bbb").withDescription("bbbbbbbb dksh fkshd fkhs dkfhsdk fhskd hksdks dhfowehfsdhfkjshf skfhkshf sf jkshfk sfh skfh skf f").create();
43 Option c = new DefaultOptionBuilder().withLongName("ccc").withShortName("c").withDescription("ccccccc").create();
44
45 Group g = new GroupBuilder().withOption(a).withOption(b).withOption(c).create();
46
47 HelpFormatter formatter = new HelpFormatter();
48 StringWriter out = new StringWriter();
49
50 formatter.setPrintWriter(new PrintWriter(out));
51 formatter.setHeader("dsfkfsh kdh hsd hsdh fkshdf ksdh fskdh fsdh fkshfk sfdkjhskjh fkjh fkjsh khsdkj hfskdhf skjdfh ksf khf s");
52 formatter.setFooter("blort j jgj j jg jhghjghjgjhgjhg jgjhgj jhg jhg hjg jgjhghjg jhg hjg jhgjg jgjhghjg jg jgjhgjgjg jhg jhgjh" + '\r' + '\n' + "rarrr");
53 formatter.setGroup(g);
54 formatter.setShellCommand("foobar");
55
56 formatter.print();
57
58 }
59 }
60