MCPcopy Index your code
hub / github.com/dunglas/httpsfv / TestParseDate

Function TestParseDate

date_test.go:39–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestParseDate(t *testing.T) {
40 t.Parallel()
41
42 data := []struct {
43 in string
44 out time.Time
45 err bool
46 }{
47 {"@1659578233", time.Unix(1659578233, 0), false},
48 {"invalid", time.Time{}, true},
49 }
50
51 for _, d := range data {
52 s := &scanner{data: d.in}
53
54 i, err := parseDate(s)
55 if d.err && err == nil {
56 t.Errorf("parse%s): error expected", d.in)
57 }
58
59 if !d.err && d.out != i {
60 t.Errorf("parse%s) = %v, %v; %v, <nil> expected", d.in, i, err, d.out)
61 }
62 }
63}

Callers

nothing calls this directly

Calls 1

parseDateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…