Skip to content
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

Open
wants to merge 7 commits into
base: v1
Choose a base branch
from

Conversation

Lucretiel
Copy link

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

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
@Lucretiel
Copy link
Author

Anything? This came up for me today. Not high priority, but would be convenient.

@ashb
Copy link

ashb commented Dec 4, 2017

This would fix #94

@niemeyer
Copy link
Contributor

niemeyer commented Dec 4, 2017

It's a bit ironic to say that in a testing project, but we need tests. :)

@ashb
Copy link

ashb commented Dec 4, 2017

I think it makes perfect sense -- if your test library isn't tested, how can you be sure it works?

It's tests all the way down!

@Lucretiel
Copy link
Author

D'oh. I'll take care of it tonight!

@Lucretiel
Copy link
Author

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
Copy link

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)

Copy link

@ashb ashb left a 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.

@Lucretiel
Copy link
Author

Bump? Anything else needed before merge?

Fixed potential regex compilation bug in matches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants