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
Add option to allow having an undercore in test methods #257
Conversation
@JanZerebecki I invoke your great regex wizard skills to enhance this PR and be closer to the rules described in #251 :) Then I just need to find a git wizard as well to get rid of the |
private function isValid($methodName) | ||
{ | ||
if ($this->getBooleanProperty('allow-underscore-test') && strpos($methodName, 'test') === 0) { | ||
return preg_match('/^test[a-zA-Z0-9]*([_][a-z][a-zA-Z0-9]*)?$/', $methodName); |
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.
Modified to only allow:
3 or more words (including "test") before the _
2 or more words after the _
or 1 or more words but no underscore
A word starts with an uper case A-Z, then zero or more lower case a-z, then zero or more numbers 0-9 are allowed.
/^test(([A-Z][a-z][0-9])+|([A-Z][a-z][0-9]){3,}_{2,}))$/
Tests not included. Wielding this regexp is unsafe without first properly testing it.
I don't get how this survived for so long. (The .gitattributes rules in this repository to convert text files from LF to the systems preferred line endings on checkout and internally to LF before diff/commit was added after this file was added; this file was added with CRLF, internally files are now stored with LF line endings.) The proper fix is to commit the converted ant-task.rst in a different commit, which I assume was the intention when adding the .gitattributes . To get rid of it from this commit do: |
Thnx!
Tried that and several other things. It always re-appears. |
Yes it only gets rid of it from your commit. That it reappears as modified in your working copy is what the .gitattributes in the repo tells git to do. Also see above what I said about a proper fix. |
@manuelpichler @ravage84 are you fine with this change? If so, I'll amend it with the latest regex |
@manuelpichler @ravage84 any progress here? |
Add option to allow having an undercore in test methods
This addresses #251.
The first commit can be merged on its own via #255