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

Function TestHandleExitCoder_MultiErrorWithFormat

errors_test.go:195–212  ·  errors_test.go::TestHandleExitCoder_MultiErrorWithFormat
(t *testing.T)

Source from the content-addressed store, hash-verified

193}
194
195func TestHandleExitCoder_MultiErrorWithFormat(t *testing.T) {
196 called := false
197
198 OsExiter = func(int) {
199 if !called {
200 called = true
201 }
202 }
203 ErrWriter = &bytes.Buffer{}
204
205 defer func() { OsExiter = fakeOsExiter }()
206
207 err := newMultiError(NewErrorWithFormat("err1"), NewErrorWithFormat("err2"))
208 HandleExitCoder(err)
209
210 assert.True(t, called)
211 assert.Equal(t, ErrWriter.(*bytes.Buffer).String(), "This the format: err1\nThis the format: err2\n")
212}
213
214func TestMultiErrorErrorsCopy(t *testing.T) {
215 errList := []error{

Callers

nothing calls this directly

Calls 4

newMultiErrorFunction · 0.85
NewErrorWithFormatFunction · 0.85
HandleExitCoderFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected