(t *testing.T)
| 171 | } |
| 172 | |
| 173 | func 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 | |
| 195 | func TestHandleExitCoder_MultiErrorWithFormat(t *testing.T) { |
| 196 | called := false |
nothing calls this directly
no test coverage detected