Skip to content

Commit

Permalink
Add test to verify help command usage
Browse files Browse the repository at this point in the history
  • Loading branch information
meatballhat committed Jun 22, 2016
1 parent 5c7afce commit be875c3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions help_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,23 @@ func Test_helpCommand_Action_ErrorIfNoTopic(t *testing.T) {
}
}

func Test_helpCommand_InHelpOutput(t *testing.T) {
app := NewApp()
output := &bytes.Buffer{}
app.Writer = output
app.Run([]string{"test", "--help"})

s := output.String()

if strings.Contains(s, "\nCOMMANDS:\nGLOBAL OPTIONS:\n") {
t.Fatalf("empty COMMANDS section detected: %q", s)
}

if !strings.Contains(s, "help, h") {
t.Fatalf("missing \"help, h\": %q", s)
}
}

func Test_helpSubcommand_Action_ErrorIfNoTopic(t *testing.T) {
app := NewApp()

Expand Down

0 comments on commit be875c3

Please sign in to comment.