-
-
Notifications
You must be signed in to change notification settings - Fork 696
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
cucumber-expressions: replace special characters #106
Conversation
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.
LGTM! I simplified the logic - it can be done with a single statement.
Since several people are likely to work on the same branch in this repo, I think we need a naming standard for branches. I propose:
library[-language][-issue]-description
- for example:
cucumber-expressions-103-replace-special-characters
.
Or if this were a bugfix that only existed in the JavaScript implementation:
cucumber-expressions-javascript-103-replace-special-characters
@@ -63,7 +63,7 @@ describe(CucumberExpression.name, () => { | |||
}) | |||
|
|||
describe('RegExp special characters', () => { | |||
['[', '\\', '^', '$', '?', '*', '+'].forEach((character) => { | |||
['\\', '[', ']', '^', '$', '.', '|', '?', '*', '+'].forEach((character) => { |
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.
I don't think this change is needed. Moving the backslash to first is fine, but the addition of the closing square bracket, dot, and pipe are unneeded.
The dot and pipe are tested separately as these tests weren't failing before implement escaping.
The closing square bracket doesn't need to be tested as that too probably isn't failing and looking up regular expression special characters, it didn't appear that you need to escape the closing square bracket.
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.
You are right those extra tests are not needed. At first I was surprised some of the characters weren't part of the reused test. Then I was surprised to see some of the characters didn't require escaping. I think adding theses tests may reduce some of the surprises/puzzles in the future - consider it documentation.
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.
I'd rather comment why those tests were excluded then have them in if they aren't needed.
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.
Ok, fine with me.
Also. @aslakhellesoy do you think this should be merged as is or should I update the ruby / java versions in this PR as well? |
We should update the ruby/java versions too, and ideally the shared tests (based on a manually copied text file for now) |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
resolves #103
Only the JS for now. After initial review, I'll update the java / ruby versions