add and test style from file
This commit is contained in:
@@ -153,3 +153,42 @@ func TestSchedulerFromFile(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSplitScheduleCommandTitle(t *testing.T) {
|
||||
cases := map[string]struct {
|
||||
in string
|
||||
schedule string
|
||||
command string
|
||||
title string
|
||||
}{
|
||||
"invalid schedule": {
|
||||
in: "* * * cmd #title",
|
||||
},
|
||||
"no title": {
|
||||
in: "* * * * * cmd ",
|
||||
schedule: "* * * * *",
|
||||
command: "cmd",
|
||||
},
|
||||
"schedule, command, title": {
|
||||
in: "* * * * * cmd #title",
|
||||
schedule: "* * * * *",
|
||||
command: "cmd #title",
|
||||
title: "title",
|
||||
},
|
||||
}
|
||||
|
||||
for name, c := range cases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
s, a, l := splitScheduleCommandTitle([]byte(c.in))
|
||||
if s != c.schedule {
|
||||
t.Error(s)
|
||||
}
|
||||
if a != c.command {
|
||||
t.Error(a)
|
||||
}
|
||||
if l != c.title {
|
||||
t.Error(l)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user