(t *testing.T)
| 3094 | } |
| 3095 | |
| 3096 | func TestHandleExitCoder_Custom(t *testing.T) { |
| 3097 | cmd := buildMinimalTestCommand() |
| 3098 | |
| 3099 | cmd.ExitErrHandler = func(context.Context, *Command, error) { |
| 3100 | _, _ = fmt.Fprintln(ErrWriter, "I'm a Custom error handler, I print what I want!") |
| 3101 | } |
| 3102 | |
| 3103 | _ = cmd.handleExitCoder(context.Background(), Exit("Default Behavior Error", 42)) |
| 3104 | |
| 3105 | output := fakeErrWriter.String() |
| 3106 | assert.Contains(t, output, "Custom", "Expected Custom Behavior from Error Handler") |
| 3107 | } |
| 3108 | |
| 3109 | func TestShellCompletionForIncompleteFlags(t *testing.T) { |
| 3110 | cmd := &Command{ |
nothing calls this directly
no test coverage detected