diff --git a/os/gcron/gcron_schedule_test.go b/os/gcron/gcron_schedule_test.go index 1404ba74d..cfb4c5ffd 100644 --- a/os/gcron/gcron_schedule_test.go +++ b/os/gcron/gcron_schedule_test.go @@ -4,8 +4,33 @@ import ( "strings" "testing" "time" + + "github.com/gogf/gf/test/gtest" ) +func TestSlash(t *testing.T) { + + runs := []struct { + spec string + expected map[int]struct{} + }{ + {"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) + if err != nil { + t.Fatal(err) + + } + t.AssertEQ(sched.week, c.expected) + } + }) + +} + func TestNext(t *testing.T) { runs := []struct { time, spec string