MCPcopy
hub / github.com/urfave/cli / TestHandleExitCoder_Custom

Function TestHandleExitCoder_Custom

command_test.go:3096–3107  ·  command_test.go::TestHandleExitCoder_Custom
(t *testing.T)

Source from the content-addressed store, hash-verified

3094}
3095
3096func 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
3109func TestShellCompletionForIncompleteFlags(t *testing.T) {
3110 cmd := &Command{

Callers

nothing calls this directly

Calls 4

buildMinimalTestCommandFunction · 0.85
ExitFunction · 0.85
handleExitCoderMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected