improve package gcron

This commit is contained in:
John Guo
2022-05-09 21:42:50 +08:00
parent 583d576cdb
commit 2e405342ca
2 changed files with 1 additions and 4 deletions

View File

@ -32,8 +32,7 @@ type cronSchedule struct {
const (
// regular expression for cron pattern, which contains 6 parts of time units.
regexForCron = `^([\-/\d\*\?,]+)\s+([\-/\d\*\?,]+)\s+([\-/\d\*\?,]+)\s+([\-/\d\*\?,]+)\s+([\-/\d\*\?,A-Za-z]+)\s+([\-/\d\*\?,A-Za-z]+)$`
regexForCron = `^([\-/\d\*\?,]+)\s+([\-/\d\*\?,]+)\s+([\-/\d\*\?,]+)\s+([\-/\d\*\?,]+)\s+([\-/\d\*\?,A-Za-z]+)\s+([\-/\d\*\?,A-Za-z]+)$`
patternItemTypeUnknown = iota
patternItemTypeWeek
patternItemTypeMonth

View File

@ -15,7 +15,6 @@ import (
)
func TestSlash(t *testing.T) {
runs := []struct {
spec string
expected map[int]struct{}
@ -23,7 +22,6 @@ func TestSlash(t *testing.T) {
{"0 0 0 * Feb Mon/2", map[int]struct{}{1: struct{}{}, 3: struct{}{}, 5: struct{}{}}},
{"0 0 0 * Feb *", map[int]struct{}{1: struct{}{}, 2: struct{}{}, 3: struct{}{}, 4: struct{}{}, 5: struct{}{}, 6: struct{}{}, 0: struct{}{}}},
}
gtest.C(t, func(t *gtest.T) {
for _, c := range runs {
sched, err := newSchedule(c.spec)