go-test / deep

Golang deep variable equality test that returns human-readable differences
MIT License
743 stars 54 forks source link

Stringer interface support #3

Open powerman opened 7 years ago

powerman commented 7 years ago

Is there any reason to generate diff text using

c.saveDiff(a.Int(), b.Int())

instead of

c.saveDiff(a, b)

At a glance second way is better because it keeps original type and thus if that type implements Stringer interface then diff will contains values in much more readable form than just a number. (With a lot of iota consts reading diff with numbers is really hard.) Of course, same probably apply to other types, not just to integer ones.

daniel-nichter commented 4 years ago

Sorry for slow reply. No significant reason that I can recall. To see how it works out, can you submit a PR? To maintain backward-compatibility, it might need to be an option that's off by default because as other issues/PRs have noted, some people depends on the diff output, so if we change it we mess things up for them.

powerman commented 4 years ago

I'm afraid it's a bit too late - I've already solved this issue another way with https://godoc.org/github.com/powerman/check. Feel free to close this issue if you like to.