File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
src/test/java/org/apache/commons/cli/help Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -426,6 +426,21 @@ void testToSyntaxOptionGroupTest() {
426426 assertEquals ("" , underTest .toSyntaxOptions (new OptionGroup ()), "empty group should return empty string" );
427427 }
428428
429+ @ Test
430+ void testToSyntaxOptionIterableTest () {
431+ final HelpFormatter underTest = HelpFormatter .builder ().get ();
432+ final List <Option > options = new ArrayList <>();
433+
434+ options .add (Option .builder ().option ("o" ).longOpt ("one" ).hasArg ().get ());
435+ options .add (Option .builder ().option ("t" ).longOpt ("two" ).hasArg ().required ().argName ("other" ).get ());
436+ options .add (Option .builder ().option ("th" ).longOpt ("three" ).required ().argName ("other" ).get ());
437+ options .add (Option .builder ().option ("f" ).argName ("other" ).get ());
438+ options .add (Option .builder ().longOpt ("five" ).hasArg ().argName ("other" ).get ());
439+ options .add (Option .builder ().longOpt ("six" ).required ().hasArg ().argName ("other" ).get ());
440+ options .add (Option .builder ().option ("s" ).longOpt ("sevem" ).hasArg ().get ());
441+ assertEquals ("[-f] [--five <other>] [-o <arg>] [-s <arg>] --six <other> -t <other> -th" , underTest .toSyntaxOptions (options ));
442+
443+ }
429444
430445 @ Test
431446 void testToSyntaxOptionOptionsTest () {
You can’t perform that action at this time.
0 commit comments