1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-27 00:34:41 +01:00

Remove (commented-out) Strptime and tests

This commit is contained in:
Oliver Steele 2017-08-05 19:36:18 +02:00
parent 4a2c4b4b39
commit 8d53a6b4a8
2 changed files with 0 additions and 39 deletions

View File

@ -44,25 +44,3 @@ func Strftime(format string, t time.Time) (string, error) {
}
return C.GoString(&cOut[0]), nil
}
// Strptime wraps the C strptime function
// func Strptime(format, s string) (time.Time, error) {
// var (
// tm = C.struct_tm{}
// cFormat = C.CString(format)
// cin = C.CString(s)
// )
// defer C.free(unsafe.Pointer(cin)) // nolint: gas
// defer C.free(unsafe.Pointer(cFormat)) // nolint: gas
// ptr := C.strptime(cin, cFormat, &tm)
// if ptr == nil {
// var zero time.Time
// return zero, &time.ParseError{
// Layout: format,
// Value: s,
// LayoutElem: format,
// ValueElem: s,
// }
// }
// return time.Date(int(tm.tm_year)+1900, time.Month(tm.tm_mon+1), int(tm.tm_mday), int(tm.tm_hour), int(tm.tm_min), int(tm.tm_sec), 0, time.UTC), nil
// }

View File

@ -100,20 +100,3 @@ func TestStrftime(t *testing.T) {
require.Equalf(t, test.expect, s, test.format)
}
}
// func TestStrptime(t *testing.T) {
// testCases := []struct{ format, in, expect string }{
// {"%a, %b %d, %Y", "Thu, Jun 29, 2017", "29 Jun 17 00:00 +0000"},
// {"%a, %b %d, %Y %H:%M", "Thu, Jun 29, 2017 15:30", "29 Jun 17 15:30 +0000"},
// // {"%a, %b %d, %Y %H:%M %Z", "Thu, Jun 29, 2017 15:30 UTC", "29 Jun 17 15:30 +0000"},
// }
// for _, test := range testCases {
// tm, err := Strptime(test.format, test.in)
// require.NoError(t, err)
// s := tm.Format(time.RFC822Z)
// require.Equal(t, test.expect, s)
// }
// _, err := Strptime("%Y", "onvald")
// require.Error(t, err)
// }