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

Add support for multiple Examples in Scenario Outline #29

Merged
merged 1 commit into from
Nov 29, 2021
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 src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ pub struct Scenario {
pub steps: Vec<Step>,
// The parsed examples from the scenario directive if found.
#[cfg_attr(feature = "parser", builder(default))]
pub examples: Option<Examples>,
pub examples: Vec<Examples>,
/// The tags for the scenarios directive if provided.
#[cfg_attr(feature = "parser", builder(default))]
pub tags: Vec<String>,
Expand Down
4 changes: 2 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ rule scenario() -> Scenario
pa:position!()
k:keyword((env.keywords().scenario)) ":" _ n:not_nl() _ nl_eof()
s:steps()?
e:examples()?
e:examples()*
pb:position!()
{
Scenario::builder()
Expand All @@ -403,7 +403,7 @@ rule scenario() -> Scenario
pa:position!()
k:keyword((env.keywords().scenario_outline)) ":" _ n:not_nl() _ nl_eof()
s:steps()?
e:examples()?
e:examples()*
pb:position!()
{
Scenario::builder()
Expand Down
17 changes: 17 additions & 0 deletions tests/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ Scenario Outline: eating
| 12 | 5 | 7 |
| 20 | 5 | 15 |

@multiple-examples
Scenario Outline: eating
Given there are <start> cucumbers
When I eat <eat> cucumbers
Then I should have <left> cucumbers

Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |

@another-misfeature-of-cucumber
Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |

@scenario-with-tab-indentation
Scenario: A second scenario test
# Below are TABs don't remove/convert them
Expand Down