(t *testing.T)
| 246 | } |
| 247 | |
| 248 | func TestNextWithTz(t *testing.T) { |
| 249 | runs := []struct { |
| 250 | time, spec string |
| 251 | expected string |
| 252 | }{ |
| 253 | // Failing tests |
| 254 | {"2016-01-03T13:09:03+0530", "14 14 * * *", "2016-01-03T14:14:00+0530"}, |
| 255 | {"2016-01-03T04:09:03+0530", "14 14 * * ?", "2016-01-03T14:14:00+0530"}, |
| 256 | |
| 257 | // Passing tests |
| 258 | {"2016-01-03T14:09:03+0530", "14 14 * * *", "2016-01-03T14:14:00+0530"}, |
| 259 | {"2016-01-03T14:00:00+0530", "14 14 * * ?", "2016-01-03T14:14:00+0530"}, |
| 260 | } |
| 261 | for _, c := range runs { |
| 262 | sched, err := ParseStandard(c.spec) |
| 263 | if err != nil { |
| 264 | t.Error(err) |
| 265 | continue |
| 266 | } |
| 267 | actual := sched.Next(getTimeTZ(c.time)) |
| 268 | expected := getTimeTZ(c.expected) |
| 269 | if !actual.Equal(expected) { |
| 270 | t.Errorf("%s, \"%s\": (expected) %v != %v (actual)", c.time, c.spec, expected, actual) |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | func getTimeTZ(value string) time.Time { |
| 276 | if value == "" { |
nothing calls this directly
no test coverage detected