Descriptiontesting/checkers: implement DeepEquals
After coming across the nil vs empty slice equality
problem for the nth time, I think it might be time
to bite the bullet and provide a version of DeepEquals
that treats nil slices as equal to empty slices.
This proposal copies code from the Go reflect
package with a couple of small adaptations to enable
that.
Apart from the two trivial if statements deleted to
implement the logic differences, there are also some
extra cases required because unlike the reflect
implementation, we have not got privileged access
to a value's content (we can't call Interface on values
derived from private struct members).
I'm not entirely sure if the name should remain identical
("jc.DeepEquals" vs "gc.DeepEquals" is not an obvious
distinction) but since the semantics are so similar,
perhaps that's ok.
https://code.launchpad.net/~rogpeppe/juju-core/467-checkers-deepequals/+merge/196247
(do not edit description out of merge proposal)
Patch Set 1 #Patch Set 2 : testing/checkers: implement DeepEquals #
Total comments: 16
MessagesTotal messages: 4
|