Add the task service. Ready to tidy the go modules.

This commit is contained in:
lishuang
2020-07-11 15:25:31 +08:00
parent 096eb7c73e
commit dbeef1cee4
8 changed files with 52 additions and 213 deletions

18
code/test/cron_test.go Normal file
View File

@ -0,0 +1,18 @@
package test
import (
"github.com/robfig/cron/v3"
"testing"
)
func TestValidateCron(t *testing.T) {
spec := "*/1 * * * * ?"
_, err := cron.Parse(spec)
if err != nil {
t.Error(err)
} else {
t.Logf("%s passed\n", spec)
}
}

View File

@ -31,7 +31,7 @@ func TestCron(t *testing.T) {
err := c.AddFunc(spec, func() {
i++
log.Println("cron running:", i)
if i == 2 {
if i == 3 {
panic("intent to panic.")
}
})