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

Function TestOptionalSecondSchedule

parser_test.go:184–204  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

182}
183
184func TestOptionalSecondSchedule(t *testing.T) {
185 parser := NewParser(SecondOptional | Minute | Hour | Dom | Month | Dow | Descriptor)
186 entries := []struct {
187 expr string
188 expected Schedule
189 }{
190 {"0 5 * * * *", every5min(time.Local)},
191 {"5 5 * * * *", every5min5s(time.Local)},
192 {"5 * * * *", every5min(time.Local)},
193 }
194
195 for _, c := range entries {
196 actual, err := parser.Parse(c.expr)
197 if err != nil {
198 t.Errorf("%s => unexpected error %v", c.expr, err)
199 }
200 if !reflect.DeepEqual(actual, c.expected) {
201 t.Errorf("%s => expected %b, got %b", c.expr, c.expected, actual)
202 }
203 }
204}
205
206func TestNormalizeFields(t *testing.T) {
207 tests := []struct {

Callers

nothing calls this directly

Calls 4

ParseMethod · 0.95
NewParserFunction · 0.85
every5minFunction · 0.85
every5min5sFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…