MCPcopy Index your code
hub / github.com/desertbit/timer / TestStop

Function TestStop

timer_test.go:111–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestStop(t *testing.T) {
112 timer := NewTimer(time.Second)
113 wasActive := timer.Stop()
114 if !wasActive {
115 t.Errorf("stop timer: was active is false")
116 }
117
118 select {
119 case <-timer.C:
120 t.Errorf("failed to stop timer")
121 case <-time.After(2 * time.Second):
122 }
123
124 wasActive = timer.Stop()
125 if wasActive {
126 t.Errorf("stop timer: was active is true")
127 }
128}
129
130func TestStopPanic(t *testing.T) {
131 defer func() {

Callers

nothing calls this directly

Calls 2

StopMethod · 0.95
NewTimerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…