cucumber / gherkin

A parser and compiler for the Gherkin language.
MIT License
181 stars 57 forks source link

Datatable malformed without compilation error #298

Open deblockt opened 3 weeks ago

deblockt commented 3 weeks ago

👓 What did you see?

    When step
      | version | contract id                          
      | 1       | 73566f56-05b1-4ef2-92bc-636f55f2789c

This step can be compiled by cucumber, but the column contract id is not send to the java implemenation.

✅ What did you expect to see?

Two expected behaviors can be expected:

📦 Which tool/library version are you using?

cucumber-java 7.15.0 java 21

🔬 How could we reproduce it?

No response

📚 Any additional context?

No response

mpkorstanje commented 1 week ago

Some context if anyone wants to look into this:

This behavior is obviously broken but it snuck into almost every implementation unnoticed. I added a test case to confirm this is the current behavior. This was intended to ensure all parsers were at least consistently wrong. Feel free to change this testcase to a failing one. As long as all parsers complain consistently it should be fine.

One problem though is that Gherkin is now 11 years old.

This means that someone out there will be using this as a feature to add comments at the back of their tables. So it would be sensible to add support for comments after a table.

Parse error:

Feature: Extra table content
  Scenario: We're a bit extra
    Given a pirate crew
      | Luffy | Zorro | Doflamingo
      | Nami  | Brook | BlackBeard

No parse error:

Feature: Extra table content
  Scenario: We're a bit extra
    Given a pirate crew
      | Luffy | Zorro |  # Doflamingo
      | Nami  | Brook | # BlackBeard

Any comment markers before the last pipe would have to be treated as regular text:

Feature: Extra table content
  Scenario: We're a bit extra
    Given a pirate crew
      | Luffy | Zorro |  # Doflamingo
      | Nami  |# Brook | # BlackBeard