-
-
Notifications
You must be signed in to change notification settings - Fork 68
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: Having a Comment before a description breaks parsing #16
Comments
If I'm understanding the grammar, this bit is what allows empty lines and comment lines to appear in between any other line in the file:
The fact that none of the grammar rules for parts of the file that I know aren't impacted by comments bother to call out empty lines or comments at all lead me to suspect that the problem with having comments before a description block is caused by the description grammar rule itself:
|
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. |
Giving this a bump. |
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. |
Having the same problem. I encountered it because I'm trying to write some documentation for my company on how to use Cucumber on our project, and I wanted to pull sections of the feature files in to that documentation so that everything stays in sync. To do so, I need to add comments to the feature file and, as @enkessler showed above, this breaks parsing. For example: # tag::featureName[]
Feature: Some feature
# end::featureName[]
# tag::featureDescription[]
description
# end::featureDescription[] [source,gherkin]
----
include::foo.feature[tag=featureDescription]
---- |
Summary
The documentation states
"Comments are only permitted at the start of a new line, anywhere in the feature file. They begin with zero or more spaces, followed by a hash sign (#) and some text."
However, placing a comment before an element's description is not considered syntactically valid by the (Ruby) parser.
Expected Behavior
The following Gherkin would parse without error:
Current Behavior
The parser throws an exception
If the comment line is removed, the file parses without error.
Possible Solution
Fix the parser so that it matches the requirements/documentation.
Steps to Reproduce (for bugs)
.feature
file with the following textContext & Motivation
Feature files are source code of a sort. As such, comments may be useful/needed on any arbitrary line in the file.
Your Environment
cucumber-gherkin
Ruby gem, 14.0.1The text was updated successfully, but these errors were encountered: