mirror of https://github.com/go-gorm/gorm.git
Fix test failed due to time round
This commit is contained in:
parent
05e1af3bfb
commit
d2741ae51e
|
@ -86,8 +86,8 @@ func AssertEqual(t *testing.T, got, expect interface{}) {
|
||||||
if curTime, ok := got.(time.Time); ok {
|
if curTime, ok := got.(time.Time); ok {
|
||||||
format := "2006-01-02T15:04:05Z07:00"
|
format := "2006-01-02T15:04:05Z07:00"
|
||||||
|
|
||||||
if curTime.Format(format) != expect.(time.Time).Format(format) {
|
if curTime.Round(time.Second).Format(format) != expect.(time.Time).Round(time.Second).Format(format) {
|
||||||
t.Errorf("%v: expect: %v, got %v", utils.FileWithLineNum(), expect.(time.Time).Format(format), curTime.Format(format))
|
t.Errorf("%v: expect: %v, got %v", utils.FileWithLineNum(), expect.(time.Time).Round(time.Second).Format(format), curTime.Round(time.Second).Format(format))
|
||||||
}
|
}
|
||||||
} else if got != expect {
|
} else if got != expect {
|
||||||
t.Errorf("%v: expect: %#v, got %#v", utils.FileWithLineNum(), expect, got)
|
t.Errorf("%v: expect: %#v, got %#v", utils.FileWithLineNum(), expect, got)
|
||||||
|
|
Loading…
Reference in New Issue