(t *testing.T)
| 138 | } |
| 139 | |
| 140 | func 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 |
| 161 | type ErrorWithFormat struct { |
nothing calls this directly
no test coverage detected