-
Notifications
You must be signed in to change notification settings - Fork 182
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
matches now support Regexp objects #93
base: v1
Are you sure you want to change the base?
Conversation
The matches function now supports Regexp objects, in case users want to only compile the regex once, before the tests run. Also modified the function to use type switches, making the logic easier to follow
Anything? This came up for me today. Not high priority, but would be convenient. |
This would fix #94 |
It's a bit ironic to say that in a testing project, but we need tests. :) |
I think it makes perfect sense -- if your test library isn't tested, how can you be sure it works?
|
D'oh. I'll take care of it tonight! |
Tests added, though I'd appreciate a manual review to make sure I didn't typo anything |
checkers.go
Outdated
if err != nil { | ||
return false, "Can't compile regex: " + err.Error() | ||
} else { | ||
matcher = m |
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.
Minor style nit: since the if returns the else {
isn't needed. (Govent or Golint is built in to my editor and has somewhat ingrained this practice in my head. I don't actually feel strongly about it though)
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.
Minor style point which I don't mind if it is fixed or not, changes and tests look good.
Bump? Anything else needed before merge? |
Fixed potential regex compilation bug in matches
The matches function now supports Regexp objects, in case users want to only compile the regex once, before the tests run.
Also modified the function to use type switches, making the logic easier to follow