Closed wca closed 2 years ago
Thanks for the PR!
What do you think is the value of using a RegexSet
here instead of a simple Regex
? How common do you think this use case is?
@LukeMathWalker I'd use it, but I can't speak for others. Users could also just create multiple mocks for non-overlapping header regexes, given that MockBuilder doesn't have an or
, or they could use RegexSet if it was an option.
Ok, I'd suggest we do the following:
header_regex
and the other named header_regex_set
. The first accepts just one regular expression, while the second one accepts multiple. The latter must also have doc tests showing multiple regexes being passed into it and clarifying the OR behaviour.HeaderRegexMatcher
to HeaderRegexSetMatcher
@LukeMathWalker Eh, I'll just go along with using Regex instead, it's fine.
Sometimes it's useful to be able to match a header based on a pattern, rather than having to specify a static string value. Mockito implements this via
.match_header("name", Matcher::Regex(...))
. This goes one step further, leveraging RegexSet.