mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
Update gcron_schedule_test.go
add test to slash template parse
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user