Skip to content

Commit f6f76ed

Browse files
committed
tests: stacked short options with short help will help
1 parent 184f5e7 commit f6f76ed

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cli_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,14 +418,20 @@ func TestParsing(t *testing.T) {
418418
cmd: NewCmd("cmd").
419419
Opt(NewOpt("aa").Required()).
420420
Subcmd(NewCmd("one").
421-
Opt(NewOpt("cc").Required())),
421+
Opt(NewBoolOpt("cc").Short('c').Required())),
422422
}
423423
tc.variations = []testInputOutput{
424424
{
425425
Case: ttCase(),
426426
args: []string{"one", "-h"},
427427
expErr: HelpOrVersionRequested{
428-
Msg: "cmd one\n\nusage:\n one [options]\n\noptions:\n --cc <arg> (required)\n -h, --help Show this help message and exit.\n",
428+
Msg: "cmd one\n\nusage:\n one [options]\n\noptions:\n -c, --cc (required)\n -h, --help Show this help message and exit.\n",
429+
},
430+
}, {
431+
Case: ttCase(),
432+
args: []string{"one", "-ch"},
433+
expErr: HelpOrVersionRequested{
434+
Msg: "cmd one\n\nusage:\n one [options]\n\noptions:\n -c, --cc (required)\n -h, --help Show this help message and exit.\n",
429435
},
430436
}, {
431437
Case: ttCase(),

0 commit comments

Comments
 (0)