Fix unit tests

This commit is contained in:
Michael Schuett 2019-01-27 17:25:59 -05:00
parent 9720ac029c
commit 50b52ca9d5
2 changed files with 44 additions and 36 deletions

View File

@ -1381,20 +1381,23 @@ func TestApp_VisibleCategories(t *testing.T) {
app.HideHelp = true app.HideHelp = true
app.Commands = []Command{ app.Commands = []Command{
{ {
Name: "command1", Name: "command1",
Category: "1", Category: "1",
HelpName: "foo command1", HelpName: "foo command1",
Hidden: true, Hidden: true,
FlagCategories: FlagCategories{},
}, },
{ {
Name: "command2", Name: "command2",
Category: "2", Category: "2",
HelpName: "foo command2", HelpName: "foo command2",
FlagCategories: FlagCategories{},
}, },
{ {
Name: "command3", Name: "command3",
Category: "3", Category: "3",
HelpName: "foo command3", HelpName: "foo command3",
FlagCategories: FlagCategories{},
}, },
} }
@ -1421,21 +1424,24 @@ func TestApp_VisibleCategories(t *testing.T) {
app.HideHelp = true app.HideHelp = true
app.Commands = []Command{ app.Commands = []Command{
{ {
Name: "command1", Name: "command1",
Category: "1", Category: "1",
HelpName: "foo command1", HelpName: "foo command1",
Hidden: true, Hidden: true,
FlagCategories: FlagCategories{},
}, },
{ {
Name: "command2", Name: "command2",
Category: "2", Category: "2",
HelpName: "foo command2", HelpName: "foo command2",
Hidden: true, Hidden: true,
FlagCategories: FlagCategories{},
}, },
{ {
Name: "command3", Name: "command3",
Category: "3", Category: "3",
HelpName: "foo command3", HelpName: "foo command3",
FlagCategories: FlagCategories{},
}, },
} }
@ -1456,22 +1462,25 @@ func TestApp_VisibleCategories(t *testing.T) {
app.HideHelp = true app.HideHelp = true
app.Commands = []Command{ app.Commands = []Command{
{ {
Name: "command1", Name: "command1",
Category: "1", Category: "1",
HelpName: "foo command1", HelpName: "foo command1",
Hidden: true, Hidden: true,
FlagCategories: FlagCategories{},
}, },
{ {
Name: "command2", Name: "command2",
Category: "2", Category: "2",
HelpName: "foo command2", HelpName: "foo command2",
Hidden: true, Hidden: true,
FlagCategories: FlagCategories{},
}, },
{ {
Name: "command3", Name: "command3",
Category: "3", Category: "3",
HelpName: "foo command3", HelpName: "foo command3",
Hidden: true, Hidden: true,
FlagCategories: FlagCategories{},
}, },
} }

View File

@ -54,12 +54,11 @@ CATEGORY:
{{.Category}}{{end}}{{if .Description}} {{.Category}}{{end}}{{if .Description}}
DESCRIPTION: DESCRIPTION:
{{.Description}}{{end}} {{.Description}}{{end}}{{if .VisibleFlagCategories}}
OPTIONS:{{range .VisibleFlagCategories}} OPTIONS:{{range .VisibleFlagCategories}}
{{.Name}} {{.Name}}
{{range .VisibleFlags}}{{.}} {{range .VisibleFlags}}{{.}}
{{end}}{{end}} {{end}}{{end}}{{end}}
` `
// SubcommandHelpTemplate is the text template for the subcommand help topic. // SubcommandHelpTemplate is the text template for the subcommand help topic.