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

tag-expressions: support escape backslashes in tag expressions #1778

Merged
merged 13 commits into from
Oct 8, 2021
Merged

tag-expressions: support escape backslashes in tag expressions #1778

merged 13 commits into from
Oct 8, 2021

Conversation

yusuke-noda
Copy link
Contributor

@yusuke-noda yusuke-noda commented Oct 5, 2021

Summary

Add support "\\" escape for backslash in tag expressions.

Details

Javascript, Java, and Go implementations of Tag Expressions cannnot handle tags containing backslashes, but Tag Expressions should be able to handle tags containing backslashes.

Motivation and Context

Fixes #1776
Fixes #1777

How Has This Been Tested?

Added the following test cases:

  • "\" before "\". a\\ and b
  • "\" before normal character. \a and b
  • "\" before space. a\ and b
  • "\" is the last character of tag expressions. a and b\
  • "\\" before unescaped parentheses. ( a and b\\)
  • "\\" before escaped parentheses. a\\\( and b\\\)
  • normal characters between "\" and parentheses. (a and \b)

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • The change has been ported to Java.
  • The change has been ported to Ruby.
  • The change has been ported to JavaScript.
  • The change has been ported to Go.
  • The change has been ported to .NET.
  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have updated the CHANGELOG accordingly.

@aurelien-reeves
Copy link
Contributor

aurelien-reeves commented Oct 5, 2021

Thanks a lot @yusuke-noda for your PR! 😀

We may have to move it to https://github.com/cucumber/tag-expressions 🤔

escaped = false
} else {
escaped = true
}
Copy link
Contributor

@mpkorstanje mpkorstanje Oct 5, 2021

Choose a reason for hiding this comment

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

Structurally the go implementation differs quite a bit from the other implementations. So I would not be opposed to lifting this case out into a separate if-block so that the escaped = false in the unicode.IsSpace(c) { block is not needed and so that the different implementations resemble each other again.

@mpkorstanje
Copy link
Contributor

We may have to move it to https://github.com/cucumber/tag-expressions thinking

@aurelien-reeves a "maybe" isn't actionable. Can you either provide clear directions or indicate that you are still looking for a solution?

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

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

In principle the changes look good to me.

@yusuke-noda are you participating in hacktober fest? I don't think we can merge this straight away but I can mark the PR as accepted for the purposes of the event.

@aurelien-reeves
Copy link
Contributor

We may have to move it to https://github.com/cucumber/tag-expressions thinking

@aurelien-reeves a "maybe" isn't actionable. Can you either provide clear directions or indicate that you are still looking for a solution?

That was the point of the "🤔" smiley. To start discussing about that because I am not sure of what should be done.

I think we should move that PR to https://github.com/cucumber/tag-expressions
What do you think?

@mpkorstanje
Copy link
Contributor

@mattwynne is there a technical reason that tag-expressions is still in located in common? Did the migration to https://github.com/cucumber/tag-expressions fail?

@yusuke-noda
Copy link
Contributor Author

@yusuke-noda are you participating in hacktober fest? I don't think we can merge this straight away but I can mark the PR as accepted for the purposes of the event.

Thank you, but i am not participating in hacktober fest.

@mattwynne
Copy link
Member

mattwynne commented Oct 7, 2021

@mattwynne is there a technical reason that tag-expressions is still in located in common? Did the migration to https://github.com/cucumber/tag-expressions fail?

It didn't fail, we're just not done with it. I've had to focus on other things this week. We still need to get the CI working over there, which might make it a tricky environment to merge a PR into, but I'm fairly ambivalent about which repo we merge it into for now, as long as we don't forget to migrate the commits to the new repo at some point.

@aurelien-reeves
Copy link
Contributor

For now I suggest to continue working here, on the monorepo.

I have opened an issue on the new repo to avoid forgetting about it later: cucumber/tag-expressions#4

@aslakhellesoy
Copy link
Contributor

Let's merge this here. Then make a release.

When that's done there won't be any open issues/PRs for tag-expressions, and we can do the migration to the new repo again.

@aslakhellesoy
Copy link
Contributor

For whomever merges this - please update the CHANGELOG.md

ehuelsmann added a commit that referenced this pull request Oct 8, 2021
The escaping backslash was added to the tag and if the escaped character
was a space, it was skipped even though being escaped.

Re #1778.
Copy link
Contributor

@ehuelsmann ehuelsmann left a comment

Choose a reason for hiding this comment

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

From my reading, the changes are correct. it looks like we can merge this PR as it is (and make the modifications that @mpkorstanje desires when this has its own repository).

@aurelien-reeves aurelien-reeves enabled auto-merge (squash) October 8, 2021 14:10
@aurelien-reeves aurelien-reeves merged commit 2bec745 into cucumber:main Oct 8, 2021
@aslakhellesoy
Copy link
Contributor

Hi @yusuke-noda,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

ehuelsmann added a commit that referenced this pull request Oct 8, 2021
)

The escaping backslash was added to the tag and if the escaped character
was a space, it was skipped even though being escaped.

Re #1778.
@yusuke-noda yusuke-noda deleted the tag-expressions-escape-backslash branch October 12, 2021 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants