MCPcopy Create free account
hub / github.com/codnect/chrono / TestCronExpression_NextTime

Function TestCronExpression_NextTime

cron_test.go:11–626  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9const timeLayout = "2006-01-02 15:04:05"
10
11func TestCronExpression_NextTime(t *testing.T) {
12 testCases := []struct {
13 expression string
14 time string
15 nextTimes []string
16 }{
17 {
18 "* * * * * *",
19 "2021-05-31 23:59:56",
20 []string{
21 "2021-05-31 23:59:57",
22 "2021-05-31 23:59:58",
23 "2021-05-31 23:59:59",
24 "2021-06-01 00:00:00",
25 "2021-06-01 00:00:01",
26 "2021-06-01 00:00:02",
27 },
28 },
29 {
30 "17/3 * * * * *",
31 "2021-03-16 15:04:16",
32 []string{
33 "2021-03-16 15:04:17",
34 "2021-03-16 15:04:20",
35 "2021-03-16 15:04:23",
36 "2021-03-16 15:04:26",
37 "2021-03-16 15:04:29",
38 "2021-03-16 15:04:32",
39 },
40 },
41 {
42 "19/3 * * * * *",
43 "2021-03-16 15:04:19",
44 []string{
45 "2021-03-16 15:04:22",
46 "2021-03-16 15:04:25",
47 "2021-03-16 15:04:28",
48 "2021-03-16 15:04:31",
49 "2021-03-16 15:04:34",
50 "2021-03-16 15:04:37",
51 },
52 },
53 {
54 "8-19/3 * * * * *",
55 "2021-03-16 15:04:23",
56 []string{
57 "2021-03-16 15:05:08",
58 "2021-03-16 15:05:11",
59 "2021-03-16 15:05:14",
60 "2021-03-16 15:05:17",
61 "2021-03-16 15:06:08",
62 "2021-03-16 15:06:11",
63 },
64 },
65 {
66 "8-24 * * * * *",
67 "2021-03-16 15:04:23",
68 []string{

Callers

nothing calls this directly

Calls 2

ParseCronExpressionFunction · 0.85
NextTimeMethod · 0.80

Tested by

no test coverage detected