MCPcopy
hub / github.com/aceld/zinx / TestTimer

Function TestTimer

ztimer/timer_test.go:21–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19}
20
21func TestTimer(t *testing.T) {
22
23 for i := 0; i < 5; i++ {
24 go func(i int) {
25 NewTimerAfter(NewDelayFunc(myFunc, []interface{}{i, 2 * i}), time.Duration(2*i)*time.Second).Run()
26 }(i)
27 }
28
29 //主进程等待其他go,由于Run()方法是用一个新的go承载延迟方法,这里不能用waitGroup
30 time.Sleep(1 * time.Minute)
31}

Callers

nothing calls this directly

Calls 3

NewTimerAfterFunction · 0.85
NewDelayFuncFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected