From 415d89281be91d3ca1fc17f47d94276e04f11b1c Mon Sep 17 00:00:00 2001 From: arseny Date: Fri, 22 May 2020 16:46:28 +0300 Subject: [PATCH] Fix time.Time not equals bug Adding test --- _codegen/go.mod | 5 ++++- _codegen/go.sum | 11 +++++++++++ assert/assertions.go | 4 +++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/_codegen/go.mod b/_codegen/go.mod index 31a7e99..061c7f3 100644 --- a/_codegen/go.mod +++ b/_codegen/go.mod @@ -2,4 +2,7 @@ module github.com/stretchr/testify/_codegen go 1.11 -require github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607 +require ( + github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607 + github.com/stretchr/testify v1.5.1 // indirect +) diff --git a/_codegen/go.sum b/_codegen/go.sum index 1c1b88e..d5d1cc0 100644 --- a/_codegen/go.sum +++ b/_codegen/go.sum @@ -1,2 +1,13 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607 h1:cTavhURetDkezJCvxFggiyLeP40Mrk/TtVg2+ycw1Es= github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607/go.mod h1:Cg4fM0vhYWOZdgM7RIOSTRNIc8/VT7CXClC3Ni86lu4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/assert/assertions.go b/assert/assertions.go index 8de6a35..94fb18c 100644 --- a/assert/assertions.go +++ b/assert/assertions.go @@ -60,7 +60,9 @@ func ObjectsAreEqual(expected, actual interface{}) bool { return expected == actual } - if tExp, ok := expected.(time.Time); ok { + tExp, ok := expected.(time.Time) + if ok { + tAct, ok := actual.(time.Time) if ok { return tExp.Equal(tAct)