You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to format a Gherkin file in which a scenario description is followed by a blank line with trailing whitespace, reformat-gherkin gives the error "INTERNAL ERROR: The new content produced is not equivalent to the source".
To Reproduce
Steps to reproduce the behaviour
Save the following feature as test.feature
Feature: A feature
Scenario: A scenario
A scenario description. The following line has trailing whitespace.
When I do something
Then something happens
(Note that the line after the scenario description contains four spaces.)
Run reformat-gherkin test.feature
Expected behaviour
The file is reformatted.
Actual behaviour
The following error occurs:
Error: cannot format /home/jtaylor/reformat-gherkin/test.feature: INTERNAL ERROR: The new content produced is not equivalent to the source.
Please report a bug on https://github.com/ducminh-phan/reformat-gherkin/issues.
This diff might be helpful: /tmp/rfmt-ghk_nt3vy6qf.log
All done! 💥 💔 💥
1 file failed to reformat.
The file /tmp/rfmt-ghk_nt3vy6qf.log contains the following:
--- src
+++ dst
@@ -1,4 +1,4 @@
-Feature(language='en', keyword='Feature', name='A feature', children=(FeatureChildren(background=None, scenario=Scenario(keyword='Scenario', name='A scenario', steps=(Step(keyword='When', text='I do something', data_table=None, doc_string=None), Step(keyword='Then', text='something happens', data_table=None, doc_string=None)), tags=(), description='A scenario description. The following line has trailing whitespace.\n', examples=()), rule=None),), tags=(), description='')
-Scenario(keyword='Scenario', name='A scenario', steps=(Step(keyword='When', text='I do something', data_table=None, doc_string=None), Step(keyword='Then', text='something happens', data_table=None, doc_string=None)), tags=(), description='A scenario description. The following line has trailing whitespace.\n', examples=())
+Feature(language='en', keyword='Feature', name='A feature', children=(FeatureChildren(background=None, scenario=Scenario(keyword='Scenario', name='A scenario', steps=(Step(keyword='When', text='I do something', data_table=None, doc_string=None), Step(keyword='Then', text='something happens', data_table=None, doc_string=None)), tags=(), description='A scenario description. The following line has trailing whitespace.', examples=()), rule=None),), tags=(), description='')
+Scenario(keyword='Scenario', name='A scenario', steps=(Step(keyword='When', text='I do something', data_table=None, doc_string=None), Step(keyword='Then', text='something happens', data_table=None, doc_string=None)), tags=(), description='A scenario description. The following line has trailing whitespace.', examples=())
Step(keyword='When', text='I do something', data_table=None, doc_string=None)
Step(keyword='Then', text='something happens', data_table=None, doc_string=None)
Environment
reformat-gherkin 3.0.1
Python 3.10.7
Ubuntu 22.04
The text was updated successfully, but these errors were encountered:
rayjolt
changed the title
Cannot round-trip Gherkin files where lines following a scenario description contain trailing whitespace
Cannot round-trip Gherkin files where a blank line following a scenario description has trailing whitespace
Oct 11, 2022
Describe the bug
When attempting to format a Gherkin file in which a scenario description is followed by a blank line with trailing whitespace, reformat-gherkin gives the error "INTERNAL ERROR: The new content produced is not equivalent to the source".
To Reproduce
Steps to reproduce the behaviour
(Note that the line after the scenario description contains four spaces.)
reformat-gherkin test.feature
Expected behaviour
The file is reformatted.
Actual behaviour
The following error occurs:
The file /tmp/rfmt-ghk_nt3vy6qf.log contains the following:
Environment
The text was updated successfully, but these errors were encountered: