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

Commented Examples table row #55

Open
Frame42 opened this issue Feb 7, 2022 · 1 comment
Open

Commented Examples table row #55

Frame42 opened this issue Feb 7, 2022 · 1 comment

Comments

@Frame42
Copy link

Frame42 commented Feb 7, 2022

Describe the bug

When reformatting files with Examples table rows commented out, the lines are moved with the next scenario instead of being kept with the table. Is this the expected behavior ?

Example input

  Scenario Outline: ScenarioA
    Given something

    @group_A
    Examples:
      | from | to |
      | 0    | 0  |
      | 0    | 1  |
      | 0    | 2  |
      | 1    | 1  |
      | 2    | 0  |
      | 1    | 0  |
      | 2    | 1  |
      | 0    | 2  |

    @group_B
    Examples:
      | from | to |
      | 0    | 0  |
#      | 0    | 1  |
#      | 0    | 2  |
      | 1    | 1  |
      | 2    | 0  |
#      | 1    | 0  |
#      | 2    | 1  |
#      | 0    | 2  |

  @TAG2
  Scenario Outline: Next Test

Expected behaviour

  Scenario Outline: ScenarioA
    Given something

    @group_A
    Examples:
      | from | to |
      | 0    | 0  |
      | 0    | 1  |
      | 0    | 2  |
      | 1    | 1  |
      | 2    | 0  |
      | 1    | 0  |
      | 2    | 1  |
      | 0    | 2  |

    @group_B
    Examples:
      | from | to |
      | 0    | 0  |
      # | 0    | 1  |
      # | 0    | 2  |
      | 1    | 1  |
      | 2    | 0  |
      # | 1    | 0  |
      # | 2    | 1  |
      # | 0    | 2  |
  
  @TAG2
  Scenario Outline: Next Test

Actual behaviour

    Given something

    @group_A
    Examples:
      | from | to |
      | 0    | 0  |
      | 0    | 1  |
      | 0    | 2  |
      | 1    | 1  |
      | 2    | 0  |
      | 1    | 0  |
      | 2    | 1  |
      | 0    | 2  |

    @group_B
    Examples:
      | from | to |
      | 0    | 0  |
      # | 0    | 1  |
      # | 0    | 2  |
      | 1    | 1  |
      | 2    | 0  |

  # | 1    | 0  |
  # | 2    | 1  |
  # | 0    | 2  |
  @TAG2
  Scenario Outline: Next Test

Environment

  • reformat-gherkin 2.2.0
  • Python 3.10
  • OS version: Windows 10
@ducminh-phan
Copy link
Owner

@Frame42 This is the expected behaviour. There is no (simple) way to know that the commented lines are commented table rows. As a workaround, you can have a non-commented table row after the commented ones. For example

  Scenario Outline: ScenarioA
    Given something

    @group_B
    Examples:
      | from | to |
      | 0    | 0  |
      # | 0    | 1  |
      # | 0    | 2  |
      | 1    | 1  |
      # | 1    | 0  |
      # | 2    | 1  |
      # | 0    | 2  |
      | 2    | 0  |

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

No branches or pull requests

2 participants