(t *testing.T)
| 39 | } |
| 40 | |
| 41 | func TestFuncPanicRecovery(t *testing.T) { |
| 42 | var buf syncWriter |
| 43 | cron := New(WithParser(secondParser), |
| 44 | WithChain(Recover(newBufLogger(&buf)))) |
| 45 | cron.Start() |
| 46 | defer cron.Stop() |
| 47 | cron.AddFunc("* * * * * ?", func() { |
| 48 | panic("YOLO") |
| 49 | }) |
| 50 | |
| 51 | select { |
| 52 | case <-time.After(OneSecond): |
| 53 | if !strings.Contains(buf.String(), "YOLO") { |
| 54 | t.Error("expected a panic to be logged, got none") |
| 55 | } |
| 56 | return |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | type DummyJob struct{} |
| 61 |
nothing calls this directly
no test coverage detected