MCPcopy
hub / github.com/robfig/cron / TestJobWithZeroTimeDoesNotRun

Function TestJobWithZeroTimeDoesNotRun

cron_test.go:545–556  ·  view source on GitHub ↗

Tests that job without time does not run

(t *testing.T)

Source from the content-addressed store, hash-verified

543
544// Tests that job without time does not run
545func 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
558func TestStopAndWait(t *testing.T) {
559 t.Run("nothing running, returns immediately", func(t *testing.T) {

Callers

nothing calls this directly

Calls 7

newWithSecondsFunction · 0.85
FuncJobFuncType · 0.85
AddFuncMethod · 0.80
ScheduleMethod · 0.80
StartMethod · 0.80
StopMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…