(t *testing.T)
| 1073 | } |
| 1074 | |
| 1075 | func TestHelpFlagExecutedOnChild(t *testing.T) { |
| 1076 | rootCmd := &Command{Use: "root", Run: emptyRun} |
| 1077 | childCmd := &Command{Use: "child", Long: "Long description", Run: emptyRun} |
| 1078 | rootCmd.AddCommand(childCmd) |
| 1079 | |
| 1080 | output, err := executeCommand(rootCmd, "child", "--help") |
| 1081 | if err != nil { |
| 1082 | t.Errorf("Unexpected error: %v", err) |
| 1083 | } |
| 1084 | |
| 1085 | checkStringContains(t, output, childCmd.Long) |
| 1086 | } |
| 1087 | |
| 1088 | // TestHelpFlagInHelp checks, |
| 1089 | // if '--help' flag is shown in help for child (executing `parent help child`), |
nothing calls this directly
no test coverage detected