Verifies calling RemoveSignal after Terminate() does not cause any unusual behaviour (panics, etc.).
(t *testing.T)
| 186 | // Verifies calling RemoveSignal after Terminate() does not cause any unusual |
| 187 | // behaviour (panics, etc.). |
| 188 | func TestSequentialHandler_RemoveAfterTerminate(t *testing.T) { |
| 189 | t.Parallel() |
| 190 | handler := NewSequentialSignalHandler() |
| 191 | handler.(Terminator).Terminate() |
| 192 | handler.(Terminator).Terminate() |
| 193 | |
| 194 | channelOne := make(chan *Signal) |
| 195 | handler.(SignalRegistrar).AddSignal(channelOne) |
| 196 | handler.(SignalRegistrar).RemoveSignal(channelOne) |
| 197 | writeSignals(handler, 10) |
| 198 | |
| 199 | count, _ := countSignals(channelOne) |
| 200 | if count > 0 { |
| 201 | t.Errorf("handler continued operating after termination; read %v signals", count) |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | func writeSignals(handler SignalHandler, count int) { |
| 206 | for i := 1; i <= count; i++ { |
nothing calls this directly
no test coverage detected
searching dependent graphs…