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

Function TestHandleExitCoder_ErrorWithFormat

errors_test.go:173–193  ·  errors_test.go::TestHandleExitCoder_ErrorWithFormat
(t *testing.T)

Source from the content-addressed store, hash-verified

171}
172
173func TestHandleExitCoder_ErrorWithFormat(t *testing.T) {
174 called := false
175
176 OsExiter = func(int) {
177 if !called {
178 called = true
179 }
180 }
181 ErrWriter = &bytes.Buffer{}
182
183 defer func() {
184 OsExiter = fakeOsExiter
185 ErrWriter = fakeErrWriter
186 }()
187
188 err := Exit(NewErrorWithFormat("I am formatted"), 1)
189 HandleExitCoder(err)
190
191 assert.True(t, called)
192 assert.Equal(t, ErrWriter.(*bytes.Buffer).String(), "This the format: I am formatted\n")
193}
194
195func TestHandleExitCoder_MultiErrorWithFormat(t *testing.T) {
196 called := false

Callers

nothing calls this directly

Calls 4

ExitFunction · 0.85
NewErrorWithFormatFunction · 0.85
HandleExitCoderFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected