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

Function TestHandleExitCoder_MultiErrorWithoutExitCoder

errors_test.go:140–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

138}
139
140func TestHandleExitCoder_MultiErrorWithoutExitCoder(t *testing.T) {
141 exitCode := 0
142 called := false
143
144 OsExiter = func(rc int) {
145 if !called {
146 exitCode = rc
147 called = true
148 }
149 }
150
151 defer func() { OsExiter = fakeOsExiter }()
152
153 err := newMultiError(errors.New("wowsa"), errors.New("egad"))
154 HandleExitCoder(err)
155
156 assert.Equal(t, 1, exitCode)
157 assert.True(t, called)
158}
159
160// make a stub to not import pkg/errors
161type ErrorWithFormat struct {

Callers

nothing calls this directly

Calls 2

newMultiErrorFunction · 0.85
HandleExitCoderFunction · 0.85

Tested by

no test coverage detected