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

The Go implementation of TagExpressions escapes parentheses even if there are other characters between the backslash and the parentheses #1777

Closed
yusuke-noda opened this issue Oct 5, 2021 · 1 comment · Fixed by #1778
Labels

Comments

@yusuke-noda
Copy link
Contributor

yusuke-noda commented Oct 5, 2021

Describe the bug
The Go implementation of TagExpressions escapes parentheses even if there are other characters between the backslash and the parentheses, such as (@foo or @\bar)

Expected behavior
Only the parentheses immediately after the backslash are escaped.

expr1, err1 = Parse("(@foo or @\bar)") // success
expr1.Evaluate([]string{"@bar"}) // return true
expr2, err2 = Parse("@foo or @\bar)") // return error "Syntax error. Unmatched )"

Current behavior
The parentheses are escaped even if there are other characters between the backslash and the parentheses.

expr1, err1 = Parse("(@foo or @\bar)") // should success, but return error "Syntax error. Unmatched ("
expr2, err2 = Parse("@foo or @\bar)") // should return error "Syntax error. Unmatched )", but success
expr2.Evaluate([]string{"@bar"}) // return false
expr2.Evaluate([]string{"@bar)"}) // return true

Your Environment

  • Tag Expressions 4.0.0
@aurelien-reeves
Copy link
Contributor

Thanks for the report!

Please note that this issue may be moved to https://github.com/cucumber/tag-expresssions soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants