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

A space following Escape \ as the last character of a table line instead of | causes StopIterationError not CompositeError #223

Closed
isparks-tg opened this issue Feb 1, 2024 · 1 comment · Fixed by #241
Assignees
Labels
🐛 bug Defect / Bug

Comments

@isparks-tg
Copy link

👓 What did you see?

A table of the form

Some step with table:
    | Name | Value |
    | A        | 1        \

Where a SPACE follows the last \ (if the space is not present then the error does not exhibit)

Python example:

from gherkin.parser import Parser
from gherkin.token_scanner import TokenScanner

feature_text = """
Feature: As a developer I want to report a bug

   Scenario: Bad table escape
      When I have a table
         | Name | Value |
         | A    |       \ """
                        # ^- Note space
parser = Parser()
parser.parse(TokenScanner(feature_text))

Will fail the parser because of StopIteration.

✅ What did you expect to see?

A CompositeParserException raised with position of error - which is what is seen if the space is removed

📦 Which tool/library version are you using?

python gherkin_official-4.1.3 but I believe exists in current github code also related to split_table_cells in gherkin_line.py

🔬 How could we reproduce it?

Steps to reproduce the behavior:

  1. Install gherkin-official.' version 'gherkin_official-4.1.3'
  2. Create a file called 'gherkin_test.py' with the contents above
  3. python gherkin_test.py
  4. See error 'RuntimeError: generator raised StopIteration'
@mpkorstanje
Copy link
Contributor

Oh nice find. Would you be interested in creating a PR to fix this? We currently don't have a maintainer with a lot of experience in Python.

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

Successfully merging a pull request may close this issue.

3 participants