MCPcopy
hub / github.com/spf13/cobra / TestHelpCommandExecuted

Function TestHelpCommandExecuted

command_test.go:941–951  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

939}
940
941func TestHelpCommandExecuted(t *testing.T) {
942 rootCmd := &Command{Use: "root", Long: "Long description", Run: emptyRun}
943 rootCmd.AddCommand(&Command{Use: "child", Run: emptyRun})
944
945 output, err := executeCommand(rootCmd, "help")
946 if err != nil {
947 t.Errorf("Unexpected error: %v", err)
948 }
949
950 checkStringContains(t, output, rootCmd.Long)
951}
952
953func TestHelpCommandExecutedOnChild(t *testing.T) {
954 rootCmd := &Command{Use: "root", Run: emptyRun}

Callers

nothing calls this directly

Calls 3

AddCommandMethod · 0.95
executeCommandFunction · 0.85
checkStringContainsFunction · 0.70

Tested by

no test coverage detected