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

Function TestHelpExecutedOnNonRunnableChild

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

Source from the content-addressed store, hash-verified

1114}
1115
1116func TestHelpExecutedOnNonRunnableChild(t *testing.T) {
1117 rootCmd := &Command{Use: "root", Run: emptyRun}
1118 childCmd := &Command{Use: "child", Long: "Long description"}
1119 rootCmd.AddCommand(childCmd)
1120
1121 output, err := executeCommand(rootCmd, "child")
1122 if err != nil {
1123 t.Errorf("Unexpected error: %v", err)
1124 }
1125
1126 checkStringContains(t, output, childCmd.Long)
1127}
1128
1129func TestSetUsageTemplate(t *testing.T) {
1130 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