(t *testing.T)
| 53 | } |
| 54 | |
| 55 | func TestCancel(t *testing.T) { |
| 56 | handlerCreated = true // this prevents goroutine from being started during the tests |
| 57 | |
| 58 | f1 := func() error { |
| 59 | return errors.New("1") |
| 60 | } |
| 61 | f2 := func() error { |
| 62 | return errors.New("2") |
| 63 | } |
| 64 | |
| 65 | cancel1 := RegisterCleaner(f1) |
| 66 | RegisterCleaner(f2) |
| 67 | |
| 68 | cancel1() |
| 69 | |
| 70 | errl := clean() |
| 71 | require.Len(t, errl, 1) |
| 72 | |
| 73 | assert.Equal(t, "2", errl[0].Error()) |
| 74 | } |
nothing calls this directly
no test coverage detected