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

fixed & simplified groovy step snippets #303

Merged
merged 1 commit into from
Apr 22, 2012

Conversation

hauner
Copy link
Contributor

@hauner hauner commented Apr 21, 2012

the generated groovy snippets do not work out of the box:

When(~"^I run cucumber$") { -> ... }

Error: Indentifier or code block expected, String end expected

the $ is a special character in groovy to embed an expression into a GString, ie. a double quoted string. To disable the groovy $ it has to be escaped...

When(~"^I run cucumber\$") { -> ... }

... or the string has to be quoted with single ticks (to make it a normal String) ...

When(~'^I run cucumber$') { -> ... }

Which has the advantage that the " does not have to be escaped as well. So it is possible to simplify

When(~"^I run cucumber with \"([^\"]*)\"\$") { String arg -> }

to:

When(~'^I run cucumber with "([^"]*)"$') { String arg -> }

I think everyone agrees that this is a lot better.. :-)

@aslakhellesoy aslakhellesoy merged commit 0a6afe5 into cucumber:master Apr 22, 2012
@lock
Copy link

lock bot commented Oct 25, 2018

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 Oct 25, 2018
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.

2 participants