corbym / gocrest

GoCrest - Hamcrest-like matchers for Go
BSD 3-Clause "New" or "Revised" License
102 stars 6 forks source link

does a NoError() matcher make sense? #7

Closed nitram509 closed 1 year ago

nitram509 commented 2 years ago

Hi,

since foo, err := bar() is a typical go style, I wonder, if a NoError() matcher would make sense to add?

Example

foo, err := bar()
then.assertThat(t, err, is.NoError())

What do you think? I would be open to create a PR ... but would like to get your view first :)

corbym commented 2 years ago

Thanks for your idea.

I think this would be fine. You could implement it as a wrapper around is.not(is.nil()). Go for it 👍

Edit: it might be better as has.NoError()

nitram509 commented 1 year ago

My motivation for contribution is too low as of now ... closing this issue ... anyone else is free to pick it up :)