smarty / assertions

Fluent assertion-style functions used by goconvey and gunit. Can also be used in any test or application.
Other
100 stars 34 forks source link

ShouldResemble and complex structs (ie. time.Time) don't play nicely #28

Closed mdwhatcott closed 6 years ago

mdwhatcott commented 6 years ago

In failure scenarios where complex structs (like time.Time instances) don't match, the resulting output is cumbersome at best to visually parse. The serializer currently makes use of the %+v formatting flag to print stuff. This might sound crazy but we could actually reimplement some of the inner workings of the fmt package to make insert inspections for fmt.GoStringer or fmt.Stringer or any other custom interface defined by the assertions package.

mdwhatcott commented 6 years ago

Ok, it's not fmt's fault--it's that we are using go-render. So, maybe there's something we can do to tweak that code?

mdwhatcott commented 6 years ago

So, we can tweak go-render to print a friendlier representation of time.Time in the case where it is a public field on a struct. All bets are off when the time instance is a private field...

mdwhatcott commented 6 years ago

Fixed: 8b2eda5c2435b8e38e4246c468c4aa5e0b261875