Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Support for inline comments in tables #39

Closed
wants to merge 1 commit into from

2 participants

Chris Worfolk Konstantin Kudryashov
Chris Worfolk

This adds supports for inline comments in tables. I've sometimes found the need to add extra information for other Gherkin authors for a particular table row, but currently it throws an error. For example:

  | column1 | column2 | column3 |
  | 1       | 1       | 1       |
  | 2       | 2       | 2       | # extra comment
  | 3       | 3       | 3       |
Konstantin Kudryashov
Owner

Ok, here's the problem. I'm not against this feature itself, but I'm against any feature that makes Behat\Gherkin not compatible with cucumber/gherkin. And cucumber/gherkin doesn't support comments in tables.

Compatibility on feature level is really important for everyone as this way your feature descriptions will stay the same in any programming language and framework - you'll just be forced to change underlying test layer. Supporting any language feature that cucumber/gherkin doesn't will mean that you will not be able to use your features as business-regression layer with application rewrite and this is a bad thing.

Keeping this in mind, I'm closing this PR :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 06, 2012
Chris Worfolk xmeltrut Support for inline comments in tables 5f29dc3
This page is out of date. Refresh to see the latest.
2  src/Behat/Gherkin/Lexer.php
@@ -434,7 +434,7 @@ protected function scanTableRow()
434 434 return;
435 435 }
436 436
437   - $line = trim($this->line);
  437 + $line = trim(preg_replace('/#([^\|]+)$/', '', trim($this->line)));
438 438
439 439 if (isset($line[0]) && '|' === $line[0]) {
440 440 $token = $this->takeToken('TableRow');
2  tests/Behat/Gherkin/Fixtures/features/tables.feature
@@ -16,5 +16,5 @@ Feature: A scenario outline
16 16 #comment
17 17 Examples:
18 18 | a | b | c |
19   - | 1 | \|2 | 3 |
  19 + | 1 | \|2 | 3 | #comment
20 20 | 2 | 3 | 4 |

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.