Skip to content

Commit

Permalink
Support multiple Examples in Scenario Outline (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilslv authored Nov 29, 2021
1 parent fa2cc05 commit 7539aed
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
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

0 comments on commit 7539aed

Please sign in to comment.