mirror of
https://github.com/rfyiamcool/cronlib.git
synced 2025-09-27 08:12:07 +08:00
cron parser test
This commit is contained in:
19
cron_parser_test.go
Normal file
19
cron_parser_test.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package cronlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestParse(t *testing.T) {
|
||||||
|
cron, err := Parse("1 0 0 */1 * *")
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
now1 := time.Date(2018, 12, 11, 05, 22, 33, 0, time.UTC)
|
||||||
|
nowAt := cron.Next(now1)
|
||||||
|
if nowAt != time.Date(2018, 12, 12, 0, 0, 1, 0, time.UTC) {
|
||||||
|
t.Error("err")
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user