Closed pajlada closed 1 year ago
@frankban I've gone ahead and pushed missing tests for this functionality to maintain the 100% test coverage of checker.go
, let me know if you prefer this to be rebased or something before being approved/merged in :slightly_smiling_face:
I added the following tests:
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
I added the following documentation: Added example for Matches checker in checker.go and in README.md Added example for ErrorMatches checker in checker.go and in README.md Added example for PanicMatches checker in checker.go and in README.md
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!