Parser Tests

Christophe Coevoet edited this page Jun 2, 2016 · 8 revisions

.tokens file format




  • line, column - line and column (indentation) numbers, one-based
  • token-type - the token type, without leading #, e.g. StepLine
  • keyword - matched keyword (including spaces where necessary, e.g. after Given), or empty
  • text - matched text (depending on the token type), or empty
  • item-list - column:item elements, separated by comma. Used for TagLine and TableRow (e.g. 1:@tag1,10:@tag2)

Reference implementation: TestTokenFormatter.cs


  • Feature: Minimal at line 1 => (1:1)FeatureLine:Feature/Minimal/
  • @scenario_tag1 @scenario_tag2 at line 5 => (5:1)TagLine://1:@scenario_tag1,16:@scenario_tag2
  • | foo|bar| boz | at line 10 => (10:7)TableRow://11:foo,15:bar,23:boz
  • # this is a comment at line 30 => (30:1)Comment:/# this is a comment/

.ast file format

  • title keywords are not indented
  • step lines are indented with two spaces
  • step arguments are indented with four spaces
  • no spaces, cell sizing for table rows
  • DocString always delimited with triple quote (so might cause an invalid gherkin)
  • tags are provided in one line
  • #language:xx header is included if xx is not en

Reference implementation: TestAstFormatter.cs