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
gherkin: Leading and trailing "\n" are trimmed in DataTable cells #290
Comments
I thought we had always been trimming leading and trailing whitespace - I must be wrong. Maybe related: cucumber-attic/gherkin#114 |
Before this commit, it does not trimmed the whitespaces, if I understand correctly: If you can give me a solution how to keep the new line at the end, that's fine with me. I already tried |
@ncsibra Cucumber-JVM v1.2.4 uses Gherkin v2.12.2, that is https://github.com/cucumber-attic/gherkin2 and not https://github.com/cucumber/gherkin-java, so tracking down this issue to somewhere in https://github.com/cucumber/gherkin-java is not really possible. |
You are right, I missed that, sorry, but tracking down the issue was for the current version, which is using https://github.com/cucumber/gherkin-java. |
No, we have always been trimming leading and trailing whitespace in table cells. The caveat here is that the leading and trailing |
Interesting, so this the expected behavior? |
I think it is a regression that should be fixed. |
Thanks for your help! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs. |
* [Gherkin / ruby] Do not trim spaces inside a table cell content (see #290) * [Gherkin / Javascript] Add test to ensure #290 is not present (and will not be) * [Gherkin / Java] Add test to ensure #290 is not present (and will not be) * [gherkin / javascript] Split tests to make them more explicit. Also wrap tests about getTableCells in its own 'describe' * [gherkin / ruby] Split tests to make them more explicit * Fix merge * Fix merge * Update changelog * Update changelog * Update changelog Co-authored-by: M.P. Korstanje <rien.korstanje@gmail.com>
After upgrading from cucumber-jvm 1.2.4 to 2.0.1, some of our tests failed.
We have steps like this:
The important thing here is the "\n" at the end.
With the older version, the "\n" was retained, but the new one trims it.
I tracked down the issue and I think it's caused by an old change here: https://github.com/cucumber/gherkin-java/blob/v4.1.3/src/main/java/gherkin/GherkinLine.java#L67
It's parsing the line from the feature file and this part of the code handle the new line character perfectly: https://github.com/cucumber/gherkin-java/blob/v4.1.3/src/main/java/gherkin/GherkinLine.java#L90
But at the end of the line(at the "|" char) it trims the string: https://github.com/cucumber/gherkin-java/blob/v4.1.3/src/main/java/gherkin/GherkinLine.java#L86
It doesn't make too much sense to me, because the original string as the variable name suggests(trimmedLineText) is already trimmed, so I think everything inside the "|" characters should remain the same, with all of the white space.
The text was updated successfully, but these errors were encountered: