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

cucumber-expressions: replace special characters #106

Merged
merged 2 commits into from
Feb 16, 2017

Conversation

charlierudolph
Copy link
Member

resolves #103

Only the JS for now. After initial review, I'll update the java / ruby versions

Copy link
Contributor

@aslakhellesoy aslakhellesoy left a 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) => {
Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fine with me.

@charlierudolph
Copy link
Member Author

Also. @aslakhellesoy do you think this should be merged as is or should I update the ruby / java versions in this PR as well?

@aslakhellesoy
Copy link
Contributor

We should update the ruby/java versions too, and ideally the shared tests (based on a manually copied text file for now)

@lock
Copy link

lock bot commented Mar 23, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cucumber-expressions: escape regex special characters
2 participants