(t *testing.T)
| 67 | } |
| 68 | |
| 69 | func TestHandleExitCoder_MultiErrorWithExitCoder(t *testing.T) { |
| 70 | exitCode := 0 |
| 71 | called := false |
| 72 | |
| 73 | OsExiter = func(rc int) { |
| 74 | if !called { |
| 75 | exitCode = rc |
| 76 | called = true |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | defer func() { OsExiter = fakeOsExiter }() |
| 81 | |
| 82 | exitErr := Exit("galactic perimeter breach", 9) |
| 83 | exitErr2 := Exit("last ExitCoder", 11) |
| 84 | |
| 85 | err := newMultiError(errors.New("wowsa"), errors.New("egad"), exitErr, exitErr2) |
| 86 | HandleExitCoder(err) |
| 87 | |
| 88 | assert.Equal(t, 11, exitCode) |
| 89 | assert.True(t, called) |
| 90 | } |
| 91 | |
| 92 | type exitFormatter struct { |
| 93 | code int |
nothing calls this directly
no test coverage detected