Skip to content

Commit d6a66f7

Browse files
committed
test: Cover behaviour when feature files contain extra blank lines
1 parent 659bcc0 commit d6a66f7

7 files changed

+191
-0
lines changed

tests/Cucumber/CompatibilityTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class CompatibilityTest extends TestCase
6060
'rule_without_name_and_description.feature' => 'Rule is wrongly parsed as Description',
6161
'incomplete_background_2.feature' => 'Background descriptions not supported',
6262
'examples_keyword_in_background_description.feature' => 'Background descriptions not supported',
63+
'extra_blank_lines_everywhere.feature' => 'Background / Examples descriptions not supported',
6364
],
6465
'gherkin-32' => [
6566
'complex_background.feature' => 'Rule keyword not supported',
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
Behat\Gherkin\Node\FeatureNode:
2+
title: 'Some feature'
3+
description: |4-
4+
5+
With a description that has
6+
7+
some blank lines before and after
8+
tags:
9+
- space-after-feature-tag
10+
background:
11+
Behat\Gherkin\Node\BackgroundNode:
12+
title: |-
13+
That is described
14+
15+
With multiple paragraphs
16+
17+
Of description
18+
steps:
19+
-
20+
Behat\Gherkin\Node\StepNode:
21+
keywordType: Given
22+
keyword: Given
23+
text: something
24+
arguments: []
25+
line: 19
26+
-
27+
Behat\Gherkin\Node\StepNode:
28+
keywordType: Given
29+
keyword: And
30+
text: 'something else'
31+
arguments: []
32+
line: 21
33+
keyword: Background
34+
line: 13
35+
description: ~
36+
scenarios:
37+
-
38+
Behat\Gherkin\Node\OutlineNode:
39+
tables:
40+
-
41+
Behat\Gherkin\Node\ExampleTableNode:
42+
keyword: Examples
43+
tags:
44+
- space-after-example-tag
45+
name: |-
46+
Here is a set of examples
47+
48+
That have blank lines in their descriptions
49+
50+
Once again
51+
description: ~
52+
maxLineLength:
53+
- 12
54+
table:
55+
43:
56+
- precondition
57+
45:
58+
- '?'
59+
47:
60+
- 'really, ?'
61+
examples: '**NOT INITIALIZED**'
62+
title: |-
63+
We will profit
64+
65+
With another very long
66+
67+
Multiple line description
68+
tags:
69+
- space-after-tag
70+
steps:
71+
-
72+
Behat\Gherkin\Node\StepNode:
73+
keywordType: When
74+
keyword: When
75+
text: '<precondition>'
76+
arguments: []
77+
line: 31
78+
-
79+
Behat\Gherkin\Node\StepNode:
80+
keywordType: Then
81+
keyword: Then
82+
text: profit
83+
arguments: []
84+
line: 33
85+
keyword: Scenario
86+
line: 25
87+
description: ~
88+
keyword: Feature
89+
language: en
90+
file: {BASEDIR}/tests/Cucumber/extra_testdata/good/extra_blank_lines_everywhere.feature
91+
line: 6
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
# language:en
3+
4+
@space-after-feature-tag
5+
6+
Feature: Some feature
7+
8+
With a description that has
9+
10+
some blank lines before and after
11+
12+
13+
Background: That is described
14+
15+
With multiple paragraphs
16+
17+
Of description
18+
19+
Given something
20+
21+
And something else
22+
23+
@space-after-tag
24+
25+
Scenario: We will profit
26+
27+
With another very long
28+
29+
Multiple line description
30+
31+
When <precondition>
32+
33+
Then profit
34+
35+
@space-after-example-tag
36+
37+
Examples: Here is a set of examples
38+
39+
That have blank lines in their descriptions
40+
41+
Once again
42+
43+
| precondition |
44+
45+
| ? |
46+
47+
| really, ? |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"gherkinDocument":{"comments":[],"feature":{"children":[{"background":{"description":" With multiple paragraphs\n\n Of description","id":"2","keyword":"Background","location":{"column":5,"line":13},"name":"That is described","steps":[{"id":"0","keyword":"Given ","keywordType":"Context","location":{"column":9,"line":19},"text":"something"},{"id":"1","keyword":"And ","keywordType":"Conjunction","location":{"column":9,"line":21},"text":"something else"}]}},{"scenario":{"description":" With another very long\n\n Multiple line description","examples":[{"description":" That have blank lines in their descriptions\n\n Once again","id":"9","keyword":"Examples","location":{"column":9,"line":37},"name":"Here is a set of examples","tableBody":[{"cells":[{"location":{"column":14,"line":45},"value":"?"}],"id":"6","location":{"column":12,"line":45}},{"cells":[{"location":{"column":14,"line":47},"value":"really, ?"}],"id":"7","location":{"column":12,"line":47}}],"tableHeader":{"cells":[{"location":{"column":14,"line":43},"value":"precondition"}],"id":"5","location":{"column":12,"line":43}},"tags":[{"id":"8","location":{"column":9,"line":35},"name":"@space-after-example-tag"}]}],"id":"11","keyword":"Scenario","location":{"column":5,"line":25},"name":"We will profit","steps":[{"id":"3","keyword":"When ","keywordType":"Action","location":{"column":9,"line":31},"text":"<precondition>"},{"id":"4","keyword":"Then ","keywordType":"Outcome","location":{"column":9,"line":33},"text":"profit"}],"tags":[{"id":"10","location":{"column":5,"line":23},"name":"@space-after-tag"}]}}],"description":" With a description that has\n\n some blank lines before and after","keyword":"Feature","language":"en","location":{"column":1,"line":6},"name":"Some feature","tags":[{"id":"12","location":{"column":1,"line":4},"name":"@space-after-feature-tag"}]},"uri":"../good/extra_blank_lines_everywhere.feature"}}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{"pickle":{"astNodeIds":["11","6"],"id":"17","language":"en","name":"We will profit","steps":[{"astNodeIds":["0"],"id":"13","text":"something","type":"Context"},{"astNodeIds":["1"],"id":"14","text":"something else","type":"Context"},{"astNodeIds":["3","6"],"id":"15","text":"?","type":"Action"},{"astNodeIds":["4","6"],"id":"16","text":"profit","type":"Outcome"}],"tags":[{"astNodeId":"12","name":"@space-after-feature-tag"},{"astNodeId":"10","name":"@space-after-tag"},{"astNodeId":"8","name":"@space-after-example-tag"}],"uri":"../good/extra_blank_lines_everywhere.feature"}}
2+
{"pickle":{"astNodeIds":["11","7"],"id":"22","language":"en","name":"We will profit","steps":[{"astNodeIds":["0"],"id":"18","text":"something","type":"Context"},{"astNodeIds":["1"],"id":"19","text":"something else","type":"Context"},{"astNodeIds":["3","7"],"id":"20","text":"really, ?","type":"Action"},{"astNodeIds":["4","7"],"id":"21","text":"profit","type":"Outcome"}],"tags":[{"astNodeId":"12","name":"@space-after-feature-tag"},{"astNodeId":"10","name":"@space-after-tag"},{"astNodeId":"8","name":"@space-after-example-tag"}],"uri":"../good/extra_blank_lines_everywhere.feature"}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"source":{"data":"\n# language:en\n\n@space-after-feature-tag\n\nFeature: Some feature\n\n With a description that has\n\n some blank lines before and after\n\n\n Background: That is described\n\n With multiple paragraphs\n\n Of description\n\n Given something\n\n And something else\n\n @space-after-tag\n\n Scenario: We will profit\n\n With another very long\n\n Multiple line description\n\n When <precondition>\n\n Then profit\n\n @space-after-example-tag\n\n Examples: Here is a set of examples\n\n That have blank lines in their descriptions\n\n Once again\n\n | precondition |\n\n | ? |\n\n | really, ? |\n","mediaType":"text/x.cucumber.gherkin+plain","uri":"../good/extra_blank_lines_everywhere.feature"}}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
(1:1)Empty://
2+
(2:1)Language:/en/
3+
(3:1)Empty://
4+
(4:1)TagLine://1:@space-after-feature-tag
5+
(5:1)Empty://
6+
(6:1)FeatureLine:()Feature/Some feature/
7+
(7:1)Empty://
8+
(8:1)Other:/ With a description that has/
9+
(9:1)Other://
10+
(10:1)Other:/ some blank lines before and after/
11+
(11:1)Other://
12+
(12:1)Other://
13+
(13:5)BackgroundLine:()Background/That is described/
14+
(14:1)Empty://
15+
(15:1)Other:/ With multiple paragraphs/
16+
(16:1)Other://
17+
(17:1)Other:/ Of description/
18+
(18:1)Other://
19+
(19:9)StepLine:(Context)Given /something/
20+
(20:1)Empty://
21+
(21:9)StepLine:(Conjunction)And /something else/
22+
(22:1)Empty://
23+
(23:5)TagLine://5:@space-after-tag
24+
(24:1)Empty://
25+
(25:5)ScenarioLine:()Scenario/We will profit/
26+
(26:1)Empty://
27+
(27:1)Other:/ With another very long/
28+
(28:1)Other://
29+
(29:1)Other:/ Multiple line description/
30+
(30:1)Other://
31+
(31:9)StepLine:(Action)When /<precondition>/
32+
(32:1)Empty://
33+
(33:9)StepLine:(Outcome)Then /profit/
34+
(34:1)Empty://
35+
(35:9)TagLine://9:@space-after-example-tag
36+
(36:1)Empty://
37+
(37:9)ExamplesLine:()Examples/Here is a set of examples/
38+
(38:1)Empty://
39+
(39:1)Other:/ That have blank lines in their descriptions/
40+
(40:1)Other://
41+
(41:1)Other:/ Once again/
42+
(42:1)Other://
43+
(43:12)TableRow://14:precondition
44+
(44:1)Empty://
45+
(45:12)TableRow://14:?
46+
(46:1)Empty://
47+
(47:12)TableRow://14:really, ?
48+
EOF

0 commit comments

Comments
 (0)