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

Function Test_helpSubcommand_Action_ErrorIfNoTopic

help_test.go:391–403  ·  help_test.go::Test_helpSubcommand_Action_ErrorIfNoTopic
(t *testing.T)

Source from the content-addressed store, hash-verified

389}
390
391func Test_helpSubcommand_Action_ErrorIfNoTopic(t *testing.T) {
392 cmd := &Command{}
393 _ = cmd.Run(context.Background(), []string{"foo", "bar"})
394
395 err := helpCommandAction(context.Background(), cmd)
396 require.Error(t, err, "expected error from helpCommandAction(), but got nil")
397
398 exitErr, ok := err.(*exitError)
399 require.True(t, ok, "expected *exitError from helpCommandAction(), but instead got: %v", err.Error())
400
401 require.Contains(t, exitErr.Error(), "No help topic for", "expected an unknown help topic error")
402 require.Equal(t, 3, exitErr.exitCode, "unexpected exit value")
403}
404
405func TestShowRootCommandHelp_CommandAliases(t *testing.T) {
406 out := &bytes.Buffer{}

Callers

nothing calls this directly

Calls 3

RunMethod · 0.95
helpCommandActionFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected