Author: bayard Date: Wed Jun 7 10:40:06 2006 New Revision: 412466 URL: http://svn.apache.org/viewvc?rev=412466&view=rev Log: Adding Andrew's unit tests for CLI-18 - they pass for me too, so marking the issue as Cannot Reproduce
Added: jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli/bug/ jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli/bug/BugCLI18Test.java jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/bug/BugCLI18Test.java Added: jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli/bug/BugCLI18Test.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli/bug/BugCLI18Test.java?rev=412466&view=auto ============================================================================== --- jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli/bug/BugCLI18Test.java (added) +++ jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli/bug/BugCLI18Test.java Wed Jun 7 10:40:06 2006 @@ -0,0 +1,42 @@ +/** + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.cli.bug; + +import org.apache.commons.cli.*; + +import java.io.PrintWriter; +import java.io.StringWriter; + +import junit.framework.TestCase; + +/** + * http://issues.apache.org/jira/browse/CLI-18 + */ +public class BugCLI18Test extends TestCase { + + public void testCLI18() { + Options options = new Options(); + options.addOption(new Option("a","aaa",false,"aaaaaaa")); + options.addOption(new Option(null,"bbb",false,"bbbbbbb dksh fkshd fkhs dkfhsdk fhskd hksdks dhfowehfsdhfkjshf skfhkshf sf jkshfk sfh skfh skf f")); + options.addOption(new Option("c",null,false,"ccccccc")); + + HelpFormatter formatter = new HelpFormatter(); + StringWriter out = new StringWriter(); + + formatter.printHelp(new PrintWriter(out),80, "foobar", "dsfkfsh kdh hsd hsdh fkshdf ksdh fskdh fsdh fkshfk sfdkjhskjh fkjh fkjsh khsdkj hfskdhf skjdfh ksf khf s", options, 2, 2, "blort j jgj j jg jhghjghjgjhgjhg jgjhgj jhg jhg hjg jgjhghjg jhg hjg jhgjg jgjhghjg jg jgjhgjgjg jhg jhgjh" + '\r' + '\n' + "rarrr", true); + } +} + Added: jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/bug/BugCLI18Test.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/bug/BugCLI18Test.java?rev=412466&view=auto ============================================================================== --- jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/bug/BugCLI18Test.java (added) +++ jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/bug/BugCLI18Test.java Wed Jun 7 10:40:06 2006 @@ -0,0 +1,59 @@ +/** + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.cli2.bug; + +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.apache.commons.cli2.Group; +import org.apache.commons.cli2.Option; +import org.apache.commons.cli2.builder.DefaultOptionBuilder; +import org.apache.commons.cli2.builder.GroupBuilder; +import org.apache.commons.cli2.util.HelpFormatter; + +import junit.framework.TestCase; + +/** + * http://issues.apache.org/jira/browse/CLI-18 + */ +public class BugCLI18Test extends TestCase { + + public BugCLI18Test() { + super(); + } + + + public void testBug() { + Option a = new DefaultOptionBuilder().withLongName("aaa").withShortName("a").withDescription("aaaaaaa").create(); + Option b = new DefaultOptionBuilder().withLongName("bbb").withDescription("bbbbbbbb dksh fkshd fkhs dkfhsdk fhskd hksdks dhfowehfsdhfkjshf skfhkshf sf jkshfk sfh skfh skf f").create(); + Option c = new DefaultOptionBuilder().withLongName("ccc").withShortName("c").withDescription("ccccccc").create(); + + Group g = new GroupBuilder().withOption(a).withOption(b).withOption(c).create(); + + HelpFormatter formatter = new HelpFormatter(); + StringWriter out = new StringWriter(); + + formatter.setPrintWriter(new PrintWriter(out)); + formatter.setHeader("dsfkfsh kdh hsd hsdh fkshdf ksdh fskdh fsdh fkshfk sfdkjhskjh fkjh fkjsh khsdkj hfskdhf skjdfh ksf khf s"); + formatter.setFooter("blort j jgj j jg jhghjghjgjhgjhg jgjhgj jhg jhg hjg jgjhghjg jhg hjg jhgjg jgjhghjg jg jgjhgjgjg jhg jhgjh" + '\r' + '\n' + "rarrr"); + formatter.setGroup(g); + formatter.setShellCommand("foobar"); + + formatter.print(); + + } +} + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]