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

Function TestHandleExitCoder_ErrorExitCoder

errors_test.go:50–67  ·  errors_test.go::TestHandleExitCoder_ErrorExitCoder
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestHandleExitCoder_ErrorExitCoder(t *testing.T) {
51 exitCode := 0
52 called := false
53
54 OsExiter = func(rc int) {
55 if !called {
56 exitCode = rc
57 called = true
58 }
59 }
60
61 defer func() { OsExiter = fakeOsExiter }()
62
63 HandleExitCoder(Exit(errors.New("galactic perimeter breach"), 9))
64
65 assert.Equal(t, 9, exitCode)
66 assert.True(t, called)
67}
68
69func TestHandleExitCoder_MultiErrorWithExitCoder(t *testing.T) {
70 exitCode := 0

Callers

nothing calls this directly

Calls 2

HandleExitCoderFunction · 0.85
ExitFunction · 0.85

Tested by

no test coverage detected