go-test / deep

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

Add NilMapsAreEmpty option. Fix map keys stringification #43

Closed yalegko closed 4 years ago

yalegko commented 4 years ago

NilMapsAreEmpty should allow to make a nil map to be equal to an empty map. Add corresponding test. All logic is the same as for NilSlicesAreEmpty.

Additionally fix printing map keys in diffs. Using %s with non string/Stringer keys leads to messages like map[%!s(int=1)]. Change it to %v which also respects Stringer but also prints other types nicely.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling f00ceba14562f55f1110b44cac3a3a3fb2989172 on yalegko:master into 3c58d730f064836fd875a220cfefdef7b2b8075a on go-test:master.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling f00ceba14562f55f1110b44cac3a3a3fb2989172 on yalegko:master into 3c58d730f064836fd875a220cfefdef7b2b8075a on go-test:master.

daniel-nichter commented 4 years ago

Nice, thanks! Released as v1.0.6.

yalegko commented 4 years ago

Great! Ty for fast release