MCPcopy
hub / github.com/rclone/rclone / TestParseTimeString

Function TestParseTimeString

backend/b2/b2_internal_test.go:161–187  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

159}
160
161func TestParseTimeString(t *testing.T) {
162 for _, test := range []struct {
163 in string
164 want time.Time
165 wantError string
166 }{
167 {"0", fstest.Time("1970-01-01T00:00:00.000000000Z"), ""},
168 {"981173110123", fstest.Time("2001-02-03T04:05:10.123000000Z"), ""},
169 {"", time.Time{}, ""},
170 {"potato", time.Time{}, `strconv.ParseInt: parsing "potato": invalid syntax`},
171 } {
172 o := Object{}
173 err := o.parseTimeString(test.in)
174 got := o.modTime
175 var gotError string
176 if err != nil {
177 gotError = err.Error()
178 }
179 if test.want != got {
180 t.Logf("%v: want %v got %v", test.in, test.want, got)
181 }
182 if test.wantError != gotError {
183 t.Logf("%v: want error %v got error %v", test.in, test.wantError, gotError)
184 }
185 }
186
187}
188
189// Return a map of the headers in the options with keys stripped of the "x-bz-info-" prefix
190func OpenOptionToMetaData(options []fs.OpenOption) map[string]string {

Callers

nothing calls this directly

Calls 4

parseTimeStringMethod · 0.95
TimeFunction · 0.92
LogfMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…