Skip to content
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ All user visible changes to `cucumber` crate will be documented in this file. Th



## main

[Diff](https://github.com/cucumber-rs/cucumber/compare/v0.22.0...main) | [Milestone](https://github.com/cucumber-rs/cucumber/milestone/31)

### Fixed

- Incorrectly disallowed spaces inside placeholders for `Examples`. ([#388], [#387])

[#387]: https://github.com/cucumber-rs/cucumber/issues/387
[#388]: https://github.com/cucumber-rs/cucumber/pull/388




## [0.22.0] · 2025-12-12
[0.22.0]: https://github.com/cucumber-rs/cucumber/tree/v0.22.0

Expand Down
10 changes: 8 additions & 2 deletions src/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,18 @@ fn expand_scenario(
) -> Vec<Result<gherkin::Scenario, ExpandExamplesError>> {
/// [`Regex`] matching placeholders [`Examples`] should expand into.
///
/// # Format
///
/// - Spaces are allowed inside placeholder.
/// - Placeholder cannot start or end with a space.
///
/// [`Examples`]: gherkin::Examples
// TODO: Switch back to `lazy-regex::regex!()` once it migrates to `std`:
// https://github.com/Canop/lazy-regex/issues/10
#[expect(clippy::unwrap_used, reason = "regex is valid")]
static TEMPLATE_REGEX: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"<([^>\s]+)>").unwrap());
static TEMPLATE_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"<([^>\s](?:[^>\s]?|[^>\t\n\r\v\f]*[^>\s]))>").unwrap()
});

if scenario.examples.is_empty() {
return vec![Ok(scenario)];
Expand Down
6 changes: 3 additions & 3 deletions tests/features/output/background_scenario_outline.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Feature: Outline
Scenario Outline: foo
Given foo is <bar1>
When foo is <bar2>
Then foo is <bar3>
Then foo is <bar 3>

Examples:
| bar1 | bar2 | bar3 |
| 1 | 2 | 3 |
| bar1 | bar2 | bar 3 |
| 1 | 2 | 3 |
26 changes: 13 additions & 13 deletions tests/features/output/background_scenario_outline.feature.debug.out

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Feature: Outline

Scenario Outline: foo
Given foo is <bar 1>
When foo is <bar two>
Then foo is <bar three>

Examples:
| bar 1 | bar two | bar three |
| 0 | 1 | 2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Feature: Outline
Scenario Outline: foo
✔ Given foo is 0
✔ When foo is 1
✔ Then foo is 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Feature: Outline
 Scenario Outline: foo
Given foo is 0
 ✔ Given foo is 0
When foo is 1
 ✔ When foo is 1
Then foo is 2
 ✔ Then foo is 2
Expand Down

Large diffs are not rendered by default.