MCPcopy
hub / github.com/davyxu/cellnet / TestLoopPanic

Function TestLoopPanic

timer/loop_test.go:10–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestLoopPanic(t *testing.T) {
11
12 q := cellnet.NewEventQueue()
13 q.EnableCapturePanic(true)
14
15 q.StartLoop()
16
17 var times = 3
18
19 NewLoop(q, time.Millisecond*100, func(loop *Loop) {
20
21 times--
22 if times == 0 {
23 loop.Stop()
24 q.StopLoop()
25 }
26
27 fmt.Println("before")
28 panic("panic")
29 fmt.Println("after")
30
31 }, nil).Start()
32
33 q.Wait()
34}

Callers

nothing calls this directly

Calls 8

EnableCapturePanicMethod · 0.95
StartLoopMethod · 0.95
StopLoopMethod · 0.95
WaitMethod · 0.95
NewEventQueueFunction · 0.92
NewLoopFunction · 0.85
StartMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected