(t *testing.T)
| 268 | } |
| 269 | |
| 270 | func TestNormalizeFields_Errors(t *testing.T) { |
| 271 | tests := []struct { |
| 272 | name string |
| 273 | input []string |
| 274 | options ParseOption |
| 275 | err string |
| 276 | }{ |
| 277 | { |
| 278 | "TwoOptionals", |
| 279 | []string{"0", "5", "*", "*", "*", "*"}, |
| 280 | SecondOptional | Minute | Hour | Dom | Month | DowOptional, |
| 281 | "", |
| 282 | }, |
| 283 | { |
| 284 | "TooManyFields", |
| 285 | []string{"0", "5", "*", "*"}, |
| 286 | SecondOptional | Minute | Hour, |
| 287 | "", |
| 288 | }, |
| 289 | { |
| 290 | "NoFields", |
| 291 | []string{}, |
| 292 | SecondOptional | Minute | Hour, |
| 293 | "", |
| 294 | }, |
| 295 | { |
| 296 | "TooFewFields", |
| 297 | []string{"*"}, |
| 298 | SecondOptional | Minute | Hour, |
| 299 | "", |
| 300 | }, |
| 301 | } |
| 302 | for _, test := range tests { |
| 303 | t.Run(test.name, func(t *testing.T) { |
| 304 | actual, err := normalizeFields(test.input, test.options) |
| 305 | if err == nil { |
| 306 | t.Errorf("expected an error, got none. results: %v", actual) |
| 307 | } |
| 308 | if !strings.Contains(err.Error(), test.err) { |
| 309 | t.Errorf("expected error %q, got %q", test.err, err.Error()) |
| 310 | } |
| 311 | }) |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | func TestStandardSpecSchedule(t *testing.T) { |
| 316 | entries := []struct { |
nothing calls this directly
no test coverage detected