(t *testing.T)
| 29 | } |
| 30 | |
| 31 | func TestHandleExitCoder_ExitCoder(t *testing.T) { |
| 32 | exitCode := 0 |
| 33 | called := false |
| 34 | |
| 35 | OsExiter = func(rc int) { |
| 36 | if !called { |
| 37 | exitCode = rc |
| 38 | called = true |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | defer func() { OsExiter = fakeOsExiter }() |
| 43 | |
| 44 | HandleExitCoder(Exit("galactic perimeter breach", 9)) |
| 45 | |
| 46 | assert.Equal(t, 9, exitCode) |
| 47 | assert.True(t, called) |
| 48 | } |
| 49 | |
| 50 | func TestHandleExitCoder_ErrorExitCoder(t *testing.T) { |
| 51 | exitCode := 0 |
nothing calls this directly
no test coverage detected