(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func 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 | } |
nothing calls this directly
no test coverage detected