Create crond scheduler and dependencies and store to disk
This commit is contained in:
36
scheduler/parser_test.go
Normal file
36
scheduler/parser_test.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package scheduler
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidCronFail(t *testing.T) {
|
||||
cases := []string{
|
||||
"a 1 1 1 1",
|
||||
"1 1 1 1",
|
||||
"1 1 1 1 1 1",
|
||||
"@minutely",
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
if validCron(c) {
|
||||
t.Error("should fail:", c)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidCronPass(t *testing.T) {
|
||||
cases := []string{
|
||||
"1 1 1 1 1",
|
||||
"* * 1 1 1",
|
||||
"@hourly",
|
||||
"@daily",
|
||||
"@yearly",
|
||||
"@weekly",
|
||||
"* */5 1 1 1",
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
if !validCron(c) {
|
||||
t.Error("should pass:", c)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user