-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding NotEqualsMatcher and generated matcher factory #113
Conversation
This also adds: - a generated matcher factory for any pegomock.Matcher - static NotEq matcher factories for "basic" types - some missing static matcher factories
110890a
to
d306e59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay this is super awesome! Thank you so much.
Small suggestion since you asked for the failure message.
And would you mind adding a couple of tests validating that both the NotEq...
matchers and the XThat...
matchers actually do what they're supposed to do? Those can go into dsl_test.go
.
And I was wondering, do you intend to add the pegomegaMatcher
matcher as well in a separate PR, or was your plan to just make that possible, but not add it to the library?
Will do
My initial intention was not to add that into the library, just to make such a matcher straightforward to use without additional boilerplate for each argument type. I meant it as an example, it didn't really feel like library quality with how the Another thing that I just realized is that I should probably add |
TBH, I haven't had a detailed look at how this would come out as an actual message in pegomock. Need to look into this a bit closer.
I like Gomega, so why not make interoperability with it easy. Feel free to do that in a separate PR if you want to get this one out first. Whatever works better for you.
Yes, would definitely define an equivalent interface in Pegomock to avoid the dependency.
I considered this briefly too when you originally proposed the Oh, and there's one more thing :-). How about documenting the new features in the README? This could also go into a separate PR if you prefer. But it would be a shame if these cool new things stay hidden for most. |
Sounds reasonable, I'll add the tests and |
- Added all the missing matcher factories including "XThat()" - Improved NotEqMatcher's FailureMessage - Some tests - Some README additions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also considering changing "But other interactions with this mock were" in the verification failure message to something like "Actual interactions with this mock were" because the current sentence sounds strange with NotEq
matching.
However, I wasn't sure if that always made sense, e.g. is that always the complete list of interactions on the mock or is it only the unmatched ones? What are your thoughts on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, I wasn't sure if that always made sense, e.g. is that always the complete list of interactions on the mock or is it only the unmatched ones? What are your thoughts on that?
I think you're actually right.
fail(fmt.Sprintf(
"Mock invocation count for %v(%v) does not match expectation%v.\n\n\t%v\n\n\t%v",
methodName, paramsOrMatchers, timeoutInfo, invocationCountMatcher.FailureMessage(), formatInteractions(genericMock.allInteractions())))
suggests that these are always all interactions. So your suggestion, "Actual interactions with this mock were", make sense I think.
So this and the little typo and I think we're good to go :-).
Super cool! Thank you so much, @yhrn. |
This also adds:
go fmt
See #110