MCPcopy
hub / github.com/urfave/cli / Test_helpCommand_Action_ErrorIfNoTopic

Function Test_helpCommand_Action_ErrorIfNoTopic

help_test.go:271–284  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

269}
270
271func Test_helpCommand_Action_ErrorIfNoTopic(t *testing.T) {
272 cmd := &Command{}
273
274 _ = cmd.Run(context.Background(), []string{"foo", "bar"})
275
276 err := helpCommandAction(context.Background(), cmd)
277 require.Error(t, err, "expected error from helpCommandAction()")
278
279 exitErr, ok := err.(*exitError)
280 require.True(t, ok, "expected *exitError from helpCommandAction()")
281
282 require.Contains(t, exitErr.Error(), "No help topic for", "expected an unknown help topic error")
283 require.Equal(t, 3, exitErr.exitCode, "expected exit value = 3")
284}
285
286func Test_helpCommand_InHelpOutput(t *testing.T) {
287 cmd := &Command{}

Callers

nothing calls this directly

Calls 3

RunMethod · 0.95
helpCommandActionFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected