Skip to content
Closed
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
4 changes: 2 additions & 2 deletions assert/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b

if !samePointers(expected, actual) {
return Fail(t, fmt.Sprintf("Not same: \n"+
"expected: %p %#v\n"+
"actual : %p %#v", expected, expected, actual, actual), msgAndArgs...)
"expected: %p %#v (%T)\n"+
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This format string is quite sensitive to the types used and sometimes duplicates details.

It's quite surprising that %#v formats MemberPtr(&Member{"Niko", 18}) as &Member{Name:"Niko", Age:18}

We need to include %T and %p, probably (%T)(%p) is the most conventional?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense,indeed

"actual : %p %#v (%T)", expected, expected, expected, actual, actual, actual), msgAndArgs...)
}

return true
Expand Down