-
Notifications
You must be signed in to change notification settings - Fork 27
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
Allow Matches and ErrorMatches matches to use an already-compiled regexp.Regexp #137
Conversation
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 think this is an interesting feature.
If you want, please go ahead!
@frankban I've gone ahead and pushed missing tests for this functionality to maintain the 100% test coverage of |
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.
The code looks good!
Could you please add:
- similar tests for ErrorMatches and PanicMatches;
- updated docs for the 3 involved checkers.
Thanks!
I added the following tests: I added the following documentation: |
…exp.Regexp This allows users to have full control over the pattern used for matching, and all of its flags (multiline)
- qt.ErrorMatches single-line match `expectedNegateFailure` - qt.ErrorMatches multi-line match `expectedNegateFailure` - qt.ErrorMatches multi-line match `expectedCheckFailure` - qt.PanicMatches single-line match `expectedNegateFailure` - qt.PanicMatches multi-line match `expectedNegateFailure` - qt.PanicMatches multi-line match `expectedCheckFailure`
6403f3a
to
b3b1f6c
Compare
…atches Documentation added both to the checker.go file and the README.md file
b3b1f6c
to
08f7639
Compare
Released as v1.14.5 |
This allows users to have full control over the regular expression used for matching.
My use-case was matching a multiline string pattern, and the way MatchString was used in the
match
-function made that infeasible.With this change, I was able to use the Matches matcher like this:
Happy to update naming of variables on request.
I left naming of parameters/arguments on purpose to keep the diff minimal, but happy to change that too.
As an alternative, if this change is not acceptable, I know I could implement my own Checker handles regular expressions like this, so no worries if this change does not fit into the project!