Author: bayard Date: Thu Feb 19 07:14:40 2009 New Revision: 745762 URL: http://svn.apache.org/viewvc?rev=745762&view=rev Log: Adding another test
Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java?rev=745762&r1=745761&r2=745762&view=diff ============================================================================== --- commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java (original) +++ commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java Thu Feb 19 07:14:40 2009 @@ -19,6 +19,8 @@ package org.apache.commons.cli.bug; import java.io.IOException; +import java.io.StringWriter; +import java.io.PrintWriter; import java.sql.ParameterMetaData; import java.sql.Types; @@ -227,4 +229,36 @@ new HelpFormatter().printHelp(this.getClass().getName(), commandLineOptions); } + public void testLongLineChunking() throws ParseException, IOException { + Options options = new Options(); + options.addOption("x", "extralongarg", false, + "This description has ReallyLongValuesThatAreLongerThanTheWidthOfTheColumns " + + "and also other ReallyLongValuesThatAreHugerAndBiggerThanTheWidthOfTheColumnsBob, " + + "yes. "); + HelpFormatter formatter = new HelpFormatter(); + StringWriter sw = new StringWriter(); + formatter.printHelp(new PrintWriter(sw), 35, this.getClass().getName(), "Header", options, 0, 5, "Footer"); + String expected = "usage:\n" + + " org.apache.commons.cli.bug.B\n" + + " ugCLI162Test\n" + + "Header\n" + + "-x,--extralongarg This\n" + + " description\n" + + " has\n" + + " ReallyLongVal\n" + + " uesThatAreLon\n" + + " gerThanTheWid\n" + + " thOfTheColumn\n" + + " s and also\n" + + " other\n" + + " ReallyLongVal\n" + + " uesThatAreHug\n" + + " erAndBiggerTh\n" + + " anTheWidthOfT\n" + + " heColumnsBob,\n" + + " yes.\n" + + "Footer\n"; + assertEquals( "Long arguments did not split as expected", expected, sw.toString() ); + } + }