Tests that job without time does not run
(t *testing.T)
| 543 | |
| 544 | // Tests that job without time does not run |
| 545 | func TestJobWithZeroTimeDoesNotRun(t *testing.T) { |
| 546 | cron := newWithSeconds() |
| 547 | var calls int64 |
| 548 | cron.AddFunc("* * * * * *", func() { atomic.AddInt64(&calls, 1) }) |
| 549 | cron.Schedule(new(ZeroSchedule), FuncJob(func() { t.Error("expected zero task will not run") })) |
| 550 | cron.Start() |
| 551 | defer cron.Stop() |
| 552 | <-time.After(OneSecond) |
| 553 | if atomic.LoadInt64(&calls) != 1 { |
| 554 | t.Errorf("called %d times, expected 1\n", calls) |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | func TestStopAndWait(t *testing.T) { |
| 559 | t.Run("nothing running, returns immediately", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…