From 2e405342ca4613b29b5fe7f6604c286e1568efe6 Mon Sep 17 00:00:00 2001 From: John Guo Date: Mon, 9 May 2022 21:42:50 +0800 Subject: [PATCH] improve package gcron --- os/gcron/{gcron_z_unit_schedule.go => gcron_schedule.go} | 3 +-- os/gcron/gcron_z_unit_schedule_test.go | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) rename os/gcron/{gcron_z_unit_schedule.go => gcron_schedule.go} (98%) diff --git a/os/gcron/gcron_z_unit_schedule.go b/os/gcron/gcron_schedule.go similarity index 98% rename from os/gcron/gcron_z_unit_schedule.go rename to os/gcron/gcron_schedule.go index 9c5432849..9e5b48a75 100644 --- a/os/gcron/gcron_z_unit_schedule.go +++ b/os/gcron/gcron_schedule.go @@ -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 diff --git a/os/gcron/gcron_z_unit_schedule_test.go b/os/gcron/gcron_z_unit_schedule_test.go index aa4515616..3a105bf8d 100644 --- a/os/gcron/gcron_z_unit_schedule_test.go +++ b/os/gcron/gcron_z_unit_schedule_test.go @@ -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)