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

Function TestFlagsInUsage

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

Source from the content-addressed store, hash-verified

1104}
1105
1106func TestFlagsInUsage(t *testing.T) {
1107 rootCmd := &Command{Use: "root", Args: NoArgs, Run: func(*Command, []string) {}}
1108 output, err := executeCommand(rootCmd, "--help")
1109 if err != nil {
1110 t.Errorf("Unexpected error: %v", err)
1111 }
1112
1113 checkStringContains(t, output, "[flags]")
1114}
1115
1116func TestHelpExecutedOnNonRunnableChild(t *testing.T) {
1117 rootCmd := &Command{Use: "root", Run: emptyRun}

Callers

nothing calls this directly

Calls 2

executeCommandFunction · 0.85
checkStringContainsFunction · 0.70

Tested by

no test coverage detected