01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.commons.cli.bug;
17:
18: import org.apache.commons.cli.*;
19:
20: import java.io.PrintWriter;
21: import java.io.StringWriter;
22:
23: import junit.framework.TestCase;
24:
25: /**
26: * http://issues.apache.org/jira/browse/CLI-18
27: */
28: public class BugCLI18Test extends TestCase {
29:
30: public void testCLI18() {
31: Options options = new Options();
32: options.addOption(new Option("a", "aaa", false, "aaaaaaa"));
33: options
34: .addOption(new Option(
35: null,
36: "bbb",
37: false,
38: "bbbbbbb dksh fkshd fkhs dkfhsdk fhskd hksdks dhfowehfsdhfkjshf skfhkshf sf jkshfk sfh skfh skf f"));
39: options.addOption(new Option("c", null, false, "ccccccc"));
40:
41: HelpFormatter formatter = new HelpFormatter();
42: StringWriter out = new StringWriter();
43:
44: formatter
45: .printHelp(
46: new PrintWriter(out),
47: 80,
48: "foobar",
49: "dsfkfsh kdh hsd hsdh fkshdf ksdh fskdh fsdh fkshfk sfdkjhskjh fkjh fkjsh khsdkj hfskdhf skjdfh ksf khf s",
50: options,
51: 2,
52: 2,
53: "blort j jgj j jg jhghjghjgjhgjhg jgjhgj jhg jhg hjg jgjhghjg jhg hjg jhgjg jgjhghjg jg jgjhgjgjg jhg jhgjh"
54: + '\r' + '\n' + "rarrr", true);
55: }
56: }
|