MCPcopy Create free account
hub / github.com/godbus/dbus / TestSequentialHandler_RemoveAfterTerminate

Function TestSequentialHandler_RemoveAfterTerminate

sequential_handler_test.go:188–203  ·  view source on GitHub ↗

Verifies calling RemoveSignal after Terminate() does not cause any unusual behaviour (panics, etc.).

(t *testing.T)

Source from the content-addressed store, hash-verified

186// Verifies calling RemoveSignal after Terminate() does not cause any unusual
187// behaviour (panics, etc.).
188func 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
205func writeSignals(handler SignalHandler, count int) {
206 for i := 1; i <= count; i++ {

Callers

nothing calls this directly

Calls 6

writeSignalsFunction · 0.85
countSignalsFunction · 0.85
TerminateMethod · 0.65
AddSignalMethod · 0.65
RemoveSignalMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…