Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions assert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ import (
"fmt"
"os"
"testing"
"time"
)

type Data struct {
Str string
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})
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=