(t *testing.T)
| 459 | } |
| 460 | |
| 461 | func TestInvalidDateTime(t *testing.T) { |
| 462 | cases := []struct { |
| 463 | name string |
| 464 | str string |
| 465 | want time.Time |
| 466 | }{ |
| 467 | { |
| 468 | name: "parse datetime without day", |
| 469 | str: "0000-00-00 21:30:45", |
| 470 | want: time.Date(0, 0, 0, 21, 30, 45, 0, time.UTC), |
| 471 | }, |
| 472 | } |
| 473 | |
| 474 | for _, cc := range cases { |
| 475 | t.Run(cc.name, func(t *testing.T) { |
| 476 | got, err := parseDateTime([]byte(cc.str), time.UTC) |
| 477 | if err != nil { |
| 478 | t.Fatal(err) |
| 479 | } |
| 480 | |
| 481 | if !cc.want.Equal(got) { |
| 482 | t.Fatalf("want: %v, but got %v", cc.want, got) |
| 483 | } |
| 484 | }) |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | func TestParseDateTimeFail(t *testing.T) { |
| 489 | cases := []struct { |
nothing calls this directly
no test coverage detected