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

gherkin: Add test case for examples under a rule with tags #2096

Merged
merged 2 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gherkin/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LANGUAGES ?= go javascript ruby java perl python dotnet php c
LANGUAGES ?= javascript go ruby java perl python dotnet php c
include default.mk

post-release: print-documentation-instructions
Expand Down
8 changes: 4 additions & 4 deletions gherkin/javascript/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ acceptance/testdata/%.ast.ndjson: ../testdata/% ../testdata/%.ast.ndjson
ifndef GOLDEN
diff --unified <(jq "." $<.ast.ndjson) <(jq "." $@)
else
cp $@ ../$(word 2,$^)
cp $@ $(word 2,$^)
endif

acceptance/testdata/%.pickles.ndjson: ../testdata/% ../testdata/%.pickles.ndjson
Expand All @@ -37,7 +37,7 @@ acceptance/testdata/%.pickles.ndjson: ../testdata/% ../testdata/%.pickles.ndjson
ifndef GOLDEN
diff --unified <(jq "." $<.pickles.ndjson) <(jq "." $@)
else
cp $@ ../$(word 2,$^)
cp $@ $(word 2,$^)
endif

acceptance/testdata/%.source.ndjson: ../testdata/% ../testdata/%.source.ndjson
Expand All @@ -46,7 +46,7 @@ acceptance/testdata/%.source.ndjson: ../testdata/% ../testdata/%.source.ndjson
ifndef GOLDEN
diff --unified <(jq "." $<.source.ndjson) <(jq "." $@)
else
cp $@ ../$(word 2,$^)
cp $@ $(word 2,$^)
endif

acceptance/testdata/%.errors.ndjson: ../testdata/% ../testdata/%.errors.ndjson
Expand All @@ -55,7 +55,7 @@ acceptance/testdata/%.errors.ndjson: ../testdata/% ../testdata/%.errors.ndjson
ifndef GOLDEN
diff --unified <(jq "." $<.errors.ndjson) <(jq "." $@)
else
cp $@ ../$(word 2,$^)
cp $@ $(word 2,$^)
endif

clean:
Expand Down
9 changes: 9 additions & 0 deletions gherkin/testdata/good/rule_with_tag.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ Feature: Some tagged rules
@tag_scenario
Scenario: Scenario with feature, rule and scenario tags
Given b

@tag_outline
Scenario Outline: Tagged Scenario outline
Given b

@examples_tag
Examples:
| header |
| a |
2 changes: 1 addition & 1 deletion gherkin/testdata/good/rule_with_tag.feature.ast.ndjson
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"gherkinDocument":{"comments":[],"feature":{"children":[{"rule":{"children":[{"scenario":{"description":"","examples":[],"id":"1","keyword":"Scenario","location":{"column":5,"line":7},"name":"Scenario with only a feature tag","steps":[{"id":"0","keyword":"Given ","keywordType":"Context","location":{"column":7,"line":8},"text":"a"}],"tags":[]}}],"description":" The untagged rule description","id":"2","keyword":"Rule","location":{"column":3,"line":4},"name":"Untagged rule","tags":[]}},{"rule":{"children":[{"scenario":{"description":"","examples":[],"id":"4","keyword":"Scenario","location":{"column":5,"line":14},"name":"Scenario with feature and rule tags","steps":[{"id":"3","keyword":"Given ","keywordType":"Context","location":{"column":7,"line":15},"text":"b"}],"tags":[]}},{"scenario":{"description":"","examples":[],"id":"7","keyword":"Scenario","location":{"column":5,"line":18},"name":"Scenario with feature, rule and scenario tags","steps":[{"id":"5","keyword":"Given ","keywordType":"Context","location":{"column":7,"line":19},"text":"b"}],"tags":[{"id":"6","location":{"column":5,"line":17},"name":"@tag_scenario"}]}}],"description":" The tagged rule description","id":"9","keyword":"Rule","location":{"column":3,"line":11},"name":"Tagged rule","tags":[{"id":"8","location":{"column":3,"line":10},"name":"@tag_rule"}]}}],"description":"","keyword":"Feature","language":"en","location":{"column":1,"line":2},"name":"Some tagged rules","tags":[{"id":"10","location":{"column":1,"line":1},"name":"@tag_feature"}]},"uri":"../testdata/good/rule_with_tag.feature"}}
{"gherkinDocument":{"comments":[],"feature":{"children":[{"rule":{"children":[{"scenario":{"description":"","examples":[],"id":"1","keyword":"Scenario","location":{"column":5,"line":7},"name":"Scenario with only a feature tag","steps":[{"id":"0","keyword":"Given ","keywordType":"Context","location":{"column":7,"line":8},"text":"a"}],"tags":[]}}],"description":" The untagged rule description","id":"2","keyword":"Rule","location":{"column":3,"line":4},"name":"Untagged rule","tags":[]}},{"rule":{"children":[{"scenario":{"description":"","examples":[],"id":"4","keyword":"Scenario","location":{"column":5,"line":14},"name":"Scenario with feature and rule tags","steps":[{"id":"3","keyword":"Given ","keywordType":"Context","location":{"column":7,"line":15},"text":"b"}],"tags":[]}},{"scenario":{"description":"","examples":[],"id":"7","keyword":"Scenario","location":{"column":5,"line":18},"name":"Scenario with feature, rule and scenario tags","steps":[{"id":"5","keyword":"Given ","keywordType":"Context","location":{"column":7,"line":19},"text":"b"}],"tags":[{"id":"6","location":{"column":5,"line":17},"name":"@tag_scenario"}]}},{"scenario":{"description":"","examples":[{"description":"","id":"12","keyword":"Examples","location":{"column":7,"line":26},"name":"","tableBody":[{"cells":[{"location":{"column":11,"line":28},"value":"a"}],"id":"10","location":{"column":9,"line":28}}],"tableHeader":{"cells":[{"location":{"column":11,"line":27},"value":"header"}],"id":"9","location":{"column":9,"line":27}},"tags":[{"id":"11","location":{"column":7,"line":25},"name":"@examples_tag"}]}],"id":"14","keyword":"Scenario Outline","location":{"column":5,"line":22},"name":"Tagged Scenario outline","steps":[{"id":"8","keyword":"Given ","keywordType":"Context","location":{"column":7,"line":23},"text":"b"}],"tags":[{"id":"13","location":{"column":5,"line":21},"name":"@tag_outline"}]}}],"description":" The tagged rule description","id":"16","keyword":"Rule","location":{"column":3,"line":11},"name":"Tagged rule","tags":[{"id":"15","location":{"column":3,"line":10},"name":"@tag_rule"}]}}],"description":"","keyword":"Feature","language":"en","location":{"column":1,"line":2},"name":"Some tagged rules","tags":[{"id":"17","location":{"column":1,"line":1},"name":"@tag_feature"}]},"uri":"../testdata/good/rule_with_tag.feature"}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mentioned some funkiness about generation, the order of the stuff here seems a bit back to front. But no idea truly 🤷

7 changes: 4 additions & 3 deletions gherkin/testdata/good/rule_with_tag.feature.pickles.ndjson
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{"pickle":{"astNodeIds":["1"],"id":"12","language":"en","name":"Scenario with only a feature tag","steps":[{"astNodeIds":["0"],"id":"11","text":"a","type":"Context"}],"tags":[{"astNodeId":"10","name":"@tag_feature"}],"uri":"../testdata/good/rule_with_tag.feature"}}
{"pickle":{"astNodeIds":["4"],"id":"14","language":"en","name":"Scenario with feature and rule tags","steps":[{"astNodeIds":["3"],"id":"13","text":"b","type":"Context"}],"tags":[{"astNodeId":"10","name":"@tag_feature"},{"astNodeId":"8","name":"@tag_rule"}],"uri":"../testdata/good/rule_with_tag.feature"}}
{"pickle":{"astNodeIds":["7"],"id":"16","language":"en","name":"Scenario with feature, rule and scenario tags","steps":[{"astNodeIds":["5"],"id":"15","text":"b","type":"Context"}],"tags":[{"astNodeId":"10","name":"@tag_feature"},{"astNodeId":"8","name":"@tag_rule"},{"astNodeId":"6","name":"@tag_scenario"}],"uri":"../testdata/good/rule_with_tag.feature"}}
{"pickle":{"astNodeIds":["1"],"id":"19","language":"en","name":"Scenario with only a feature tag","steps":[{"astNodeIds":["0"],"id":"18","text":"a","type":"Context"}],"tags":[{"astNodeId":"17","name":"@tag_feature"}],"uri":"../testdata/good/rule_with_tag.feature"}}
{"pickle":{"astNodeIds":["4"],"id":"21","language":"en","name":"Scenario with feature and rule tags","steps":[{"astNodeIds":["3"],"id":"20","text":"b","type":"Context"}],"tags":[{"astNodeId":"17","name":"@tag_feature"},{"astNodeId":"15","name":"@tag_rule"}],"uri":"../testdata/good/rule_with_tag.feature"}}
{"pickle":{"astNodeIds":["7"],"id":"23","language":"en","name":"Scenario with feature, rule and scenario tags","steps":[{"astNodeIds":["5"],"id":"22","text":"b","type":"Context"}],"tags":[{"astNodeId":"17","name":"@tag_feature"},{"astNodeId":"15","name":"@tag_rule"},{"astNodeId":"6","name":"@tag_scenario"}],"uri":"../testdata/good/rule_with_tag.feature"}}
{"pickle":{"astNodeIds":["14","10"],"id":"25","language":"en","name":"Tagged Scenario outline","steps":[{"astNodeIds":["8","10"],"id":"24","text":"b","type":"Context"}],"tags":[{"astNodeId":"17","name":"@tag_feature"},{"astNodeId":"15","name":"@tag_rule"},{"astNodeId":"13","name":"@tag_outline"},{"astNodeId":"11","name":"@examples_tag"}],"uri":"../testdata/good/rule_with_tag.feature"}}
2 changes: 1 addition & 1 deletion gherkin/testdata/good/rule_with_tag.feature.source.ndjson
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"source":{"data":"@tag_feature\nFeature: Some tagged rules\n\n Rule: Untagged rule\n The untagged rule description\n\n Scenario: Scenario with only a feature tag\n Given a\n\n @tag_rule\n Rule: Tagged rule\n The tagged rule description\n\n Scenario: Scenario with feature and rule tags\n Given b\n\n @tag_scenario\n Scenario: Scenario with feature, rule and scenario tags\n Given b\n","mediaType":"text/x.cucumber.gherkin+plain","uri":"../testdata/good/rule_with_tag.feature"}}
{"source":{"data":"@tag_feature\nFeature: Some tagged rules\n\n Rule: Untagged rule\n The untagged rule description\n\n Scenario: Scenario with only a feature tag\n Given a\n\n @tag_rule\n Rule: Tagged rule\n The tagged rule description\n\n Scenario: Scenario with feature and rule tags\n Given b\n\n @tag_scenario\n Scenario: Scenario with feature, rule and scenario tags\n Given b\n\n @tag_outline\n Scenario Outline: Tagged Scenario outline\n Given b\n\n @examples_tag\n Examples:\n | header |\n | a |\n","mediaType":"text/x.cucumber.gherkin+plain","uri":"../testdata/good/rule_with_tag.feature"}}
9 changes: 9 additions & 0 deletions gherkin/testdata/good/rule_with_tag.feature.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,13 @@
(17:5)TagLine://5:@tag_scenario
(18:5)ScenarioLine:()Scenario/Scenario with feature, rule and scenario tags/
(19:7)StepLine:(Context)Given /b/
(20:1)Empty://
(21:5)TagLine://5:@tag_outline
(22:5)ScenarioLine:()Scenario Outline/Tagged Scenario outline/
(23:7)StepLine:(Context)Given /b/
(24:1)Empty://
(25:7)TagLine://7:@examples_tag
(26:7)ExamplesLine:()Examples//
(27:9)TableRow://11:header
(28:9)TableRow://11:a
EOF