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

Function TestWithVerboseLogger

option_test.go:25–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23}
24
25func TestWithVerboseLogger(t *testing.T) {
26 var buf syncWriter
27 var logger = log.New(&buf, "", log.LstdFlags)
28 c := New(WithLogger(VerbosePrintfLogger(logger)))
29 if c.logger.(printfLogger).logger != logger {
30 t.Error("expected provided logger")
31 }
32
33 c.AddFunc("@every 1s", func() {})
34 c.Start()
35 time.Sleep(OneSecond)
36 c.Stop()
37 out := buf.String()
38 if !strings.Contains(out, "schedule,") ||
39 !strings.Contains(out, "run,") {
40 t.Error("expected to see some actions, got:", out)
41 }
42}

Callers

nothing calls this directly

Calls 8

StringMethod · 0.95
NewFunction · 0.85
WithLoggerFunction · 0.85
VerbosePrintfLoggerFunction · 0.85
AddFuncMethod · 0.80
StartMethod · 0.80
StopMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected