From be875c395c0b00ecc198c002a78c5d0bc79f297e Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 22 Jun 2016 09:41:42 -0400 Subject: [PATCH] Add test to verify help command usage --- help_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/help_test.go b/help_test.go index a664865..7c15400 100644 --- a/help_test.go +++ b/help_test.go @@ -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()