onsi / gomega

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

new: make collection-related matchers Go 1.23 iterator aware, resolves onsi/gomega#795 #798

Closed thediveo closed 1 day ago

thediveo commented 4 days ago
onsi commented 4 days ago

wonderful :) will take a close look today/tomorrow. thanks for this!

onsi commented 1 day ago

hey this is fantastic - thank you. it's clear a lot of care, time, and thought when into both the code and the documentation and I really appreciate that! 🤩

i've merged it in. The only thought I had, looking through it, is around output when the matchers fail. For example, if you pass ContainElement a slice Gomega will spit out the whole slice along with the message "to contain X". My sense is that seeing the whole slice is often helpful for understanding the failure.

I believe the new code would emit the iterator function instead of the returned elements. In part this is a good thing: no need to collect all the elements to make an assertion, especially when you don't need them all to succeed/fail. But I wonder how it'll play out as folks start using it in anger.

None of that needs to be changed today. I say we ship this and get it out there. If folks start opening issues and/or we start to bump into this pain signal we can consider subsequent improvements. Sound good? You good with me cutting a release soon?

thediveo commented 1 day ago

Yes on all your points!

There are different ways to alleviate:

thediveo commented 6 hours ago

and yes, please cut a release if you please 😀

onsi commented 1 hour ago

done! and makes sense on the ways to alleviate. Thanks for this super valuable contribution!