diff --git a/assert_test.go b/assert_test.go index 227f6b3..f9626c1 100644 --- a/assert_test.go +++ b/assert_test.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "testing" + "time" ) type Data struct { @@ -11,6 +12,14 @@ type Data struct { Num int64 } +type MyTime struct { + time.Time +} + +type MyStruct struct { + TheTime *MyTime +} + func TestEqual(t *testing.T) { assertOk(t, "IdenticalStruct", func(t testing.TB) { Equal(t, Data{"expected", 1234}, Data{"expected", 1234}) @@ -36,6 +45,9 @@ func TestEqual(t *testing.T) { assertOk(t, "Exclude", func(t testing.TB) { Equal(t, Data{Str: "expected", Num: 1234}, Data{Str: "expected"}, Exclude[int64]()) }) + assertOk(t, "Embedded time.Time", func(t testing.TB) { + Equal(t, MyStruct{}, MyStruct{}) + }) } func TestEqualStrings(t *testing.T) { diff --git a/go.mod b/go.mod index 4afac6e..db9bc8d 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/alecthomas/assert/v2 go 1.18 require ( - github.com/alecthomas/repr v0.4.0 + github.com/alecthomas/repr v0.5.2 github.com/hexops/gotextdiff v1.0.3 ) diff --git a/go.sum b/go.sum index a1ed215..56b7fe8 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,6 @@ github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs= +github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=