mirror of
https://github.com/usememos/memos.git
synced 2025-04-13 09:02:09 +02:00
chore: fix tests
This commit is contained in:
parent
35cf975e76
commit
0a871b8960
@ -667,7 +667,6 @@ func TestStopAndWait(t *testing.T) {
|
|||||||
case <-time.After(time.Millisecond):
|
case <-time.After(time.Millisecond):
|
||||||
t.Error("context not done even when cron Stop is completed")
|
t.Error("context not done even when cron Stop is completed")
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ func TestRange(t *testing.T) {
|
|||||||
{"*/2", 1, 3, 1<<1 | 1<<3, ""},
|
{"*/2", 1, 3, 1<<1 | 1<<3, ""},
|
||||||
|
|
||||||
{"5--5", 0, 0, zero, "too many hyphens"},
|
{"5--5", 0, 0, zero, "too many hyphens"},
|
||||||
{"jan-x", 0, 0, zero, "failed to parse int from"},
|
{"jan-x", 0, 0, zero, `failed to parse number: strconv.Atoi: parsing "jan": invalid syntax`},
|
||||||
{"2-x", 1, 5, zero, "failed to parse int from"},
|
{"2-x", 1, 5, zero, `failed to parse number: strconv.Atoi: parsing "x": invalid syntax`},
|
||||||
{"*/-12", 0, 0, zero, "negative number"},
|
{"*/-12", 0, 0, zero, "number must be positive"},
|
||||||
{"*//2", 0, 0, zero, "too many slashes"},
|
{"*//2", 0, 0, zero, "too many slashes"},
|
||||||
{"1", 3, 5, zero, "below minimum"},
|
{"1", 3, 5, zero, "below minimum"},
|
||||||
{"6", 3, 5, zero, "above maximum"},
|
{"6", 3, 5, zero, "above maximum"},
|
||||||
{"5-3", 3, 5, zero, "beyond end of range"},
|
{"5-3", 3, 5, zero, "beginning of range after end: 5-3"},
|
||||||
{"*/0", 0, 0, zero, "should be a positive number"},
|
{"*/0", 0, 0, zero, "step cannot be zero: */0"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range ranges {
|
for _, c := range ranges {
|
||||||
@ -120,10 +120,10 @@ func TestBits(t *testing.T) {
|
|||||||
|
|
||||||
func TestParseScheduleErrors(t *testing.T) {
|
func TestParseScheduleErrors(t *testing.T) {
|
||||||
var tests = []struct{ expr, err string }{
|
var tests = []struct{ expr, err string }{
|
||||||
{"* 5 j * * *", "failed to parse int from"},
|
{"* 5 j * * *", `failed to parse number: strconv.Atoi: parsing "j": invalid syntax`},
|
||||||
{"@every Xm", "failed to parse duration"},
|
{"@every Xm", "failed to parse duration"},
|
||||||
{"@unrecognized", "unrecognized descriptor"},
|
{"@unrecognized", "unrecognized descriptor"},
|
||||||
{"* * * *", "expected 5 to 6 fields"},
|
{"* * * *", "incorrect number of fields, expected 5-6"},
|
||||||
{"", "empty spec string"},
|
{"", "empty spec string"},
|
||||||
}
|
}
|
||||||
for _, c := range tests {
|
for _, c := range tests {
|
||||||
@ -328,11 +328,11 @@ func TestStandardSpecSchedule(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
expr: "5 j * * *",
|
expr: "5 j * * *",
|
||||||
err: "failed to parse int from",
|
err: `failed to parse number: strconv.Atoi: parsing "j": invalid syntax`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expr: "* * * *",
|
expr: "* * * *",
|
||||||
err: "expected exactly 5 fields",
|
err: "incorrect number of fields",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user