onsi / gomega

Ginkgo's Preferred Matcher Library
http://onsi.github.io/gomega/
MIT License
2.13k stars 282 forks source link

Inverted arguments order of FailureMessage of BeComparableToMatcher #723

Closed antonincms closed 6 months ago

antonincms commented 6 months ago

BeComparableTo behaved differently between Match and FailureMessage which made asymmetric go-cmp Options (e.g. https://pkg.go.dev/k8s.io/apimachinery/pkg/util/diff#IgnoreUnset) print a nonsensical error message.

Fixed this issue by inverting order or comparison, and improved a bit messages.

Fixes #719.

onsi commented 6 months ago

hey @antonincms - the tests appear to be failing. do you mind taking a look?

antonincms commented 6 months ago

@onsi Indeed, sorry to not have check that locally beforehand. I modified the message to add more context instead of just printing the diff, but the test checks the message. Do you like this change (and I'll update the test) or do you prefer keeping only the fix without that change ?

onsi commented 6 months ago

thanks - the change is good, just the tests that need to be fixed

onsi commented 6 months ago

perfect, thanks!