(t *testing.T)
| 157 | } |
| 158 | |
| 159 | func TestSubcommandExecuteC(t *testing.T) { |
| 160 | rootCmd := &Command{Use: "root", Run: emptyRun} |
| 161 | childCmd := &Command{Use: "child", Run: emptyRun} |
| 162 | rootCmd.AddCommand(childCmd) |
| 163 | |
| 164 | c, output, err := executeCommandC(rootCmd, "child") |
| 165 | if output != "" { |
| 166 | t.Errorf("Unexpected output: %v", output) |
| 167 | } |
| 168 | if err != nil { |
| 169 | t.Errorf("Unexpected error: %v", err) |
| 170 | } |
| 171 | |
| 172 | if c.Name() != "child" { |
| 173 | t.Errorf(`invalid command returned from ExecuteC: expected "child"', got: %q`, c.Name()) |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | func TestExecuteContext(t *testing.T) { |
| 178 | ctx := context.TODO() |
nothing calls this directly
no test coverage detected