This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-cli.git
commit 1119dbb53587e9a630699339fc49d955f4e57e47 Author: Gary Gregory <[email protected]> AuthorDate: Sat Jun 27 11:35:55 2026 +0000 Sort members --- .../apache/commons/cli/help/HelpFormatterTest.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/test/java/org/apache/commons/cli/help/HelpFormatterTest.java b/src/test/java/org/apache/commons/cli/help/HelpFormatterTest.java index 6b306566..24d8197b 100644 --- a/src/test/java/org/apache/commons/cli/help/HelpFormatterTest.java +++ b/src/test/java/org/apache/commons/cli/help/HelpFormatterTest.java @@ -147,6 +147,19 @@ class HelpFormatterTest { assertEquals(0, sb.length(), "Should not write to output"); } + /** + * Tests example from the mailing list that caused an infinite loop. + * + * @see <a href="https://issues.apache.org/jira/browse/CLI-351">[CLI-351] Multiple traililng BREAK_CHAR_SET characters cause infinite loop in + * HelpFormatter</a> + */ + @Test + void testPrintHelpHeader() throws IOException { + HelpFormatter.builder().get().printHelp("CL syntax", "Header", Collections.emptyList(), "Footer", true); + HelpFormatter.builder().get().printHelp("CL syntax", "Header\n\n", // This makes printHelp enter into an infinite loop + Collections.emptyList(), "Footer", true); + } + @Test void testPrintHelpWithDefaults() throws IOException { final StringBuilder sb = new StringBuilder(); @@ -167,19 +180,6 @@ class HelpFormatterTest { assertEquals(expected, actual); } - /** - * Tests example from the mailing list that caused an infinite loop. - * - * @see <a href="https://issues.apache.org/jira/browse/CLI-351">[CLI-351] Multiple traililng BREAK_CHAR_SET characters cause infinite loop in - * HelpFormatter</a> - */ - @Test - void testPrintHelpHeader() throws IOException { - HelpFormatter.builder().get().printHelp("CL syntax", "Header", Collections.emptyList(), "Footer", true); - HelpFormatter.builder().get().printHelp("CL syntax", "Header\n\n", // This makes printHelp enter into an infinite loop - Collections.emptyList(), "Footer", true); - } - @Test void testPrintHelpWithIterableOptions() throws IOException { final StringBuilder sb = new StringBuilder();
