(t *testing.T)
| 951 | } |
| 952 | |
| 953 | func TestHelpCommandExecutedOnChild(t *testing.T) { |
| 954 | rootCmd := &Command{Use: "root", Run: emptyRun} |
| 955 | childCmd := &Command{Use: "child", Long: "Long description", Run: emptyRun} |
| 956 | rootCmd.AddCommand(childCmd) |
| 957 | |
| 958 | output, err := executeCommand(rootCmd, "help", "child") |
| 959 | if err != nil { |
| 960 | t.Errorf("Unexpected error: %v", err) |
| 961 | } |
| 962 | |
| 963 | checkStringContains(t, output, childCmd.Long) |
| 964 | } |
| 965 | |
| 966 | func TestHelpCommandExecutedOnChildWithFlagThatShadowsParentFlag(t *testing.T) { |
| 967 | parent := &Command{Use: "parent", Run: emptyRun} |
nothing calls this directly
no test coverage detected