| Crates.io | rstest-bdd-patterns |
| lib.rs | rstest-bdd-patterns |
| version | 0.4.0 |
| created_at | 2025-09-27 20:40:22.332467+00 |
| updated_at | 2026-01-22 22:19:25.48593+00 |
| description | Shared step-pattern compilation utilities for rstest-bdd. |
| homepage | https://github.com/leynos/rstest-bdd |
| repository | https://github.com/leynos/rstest-bdd |
| max_upload_size | |
| id | 1857668 |
| size | 66,157 |
Shared step-pattern compilation utilities used by both the
rstest-bdd runtime crate and the
rstest-bdd-macros procedural
macros. The crate exposes the placeholder parsing and regex generation engine
so both dependants can validate and execute Behaviour-Driven Development steps
without duplicating logic.
The API is intentionally small: it provides helpers for turning annotated step literals into regular expressions, along with supporting error types and placeholder parsing utilities. Downstream crates wrap these primitives in user-facing APIs tailored to their compile-time or runtime responsibilities.
use regex::Regex;
use rstest_bdd_patterns::{build_regex_from_pattern, extract_captured_values};
let regex_src = build_regex_from_pattern("I have {count:u32}")
.expect("example ensures fallible call succeeds");
let regex = Regex::new(®ex_src)
.expect("example ensures fallible call succeeds");
let captures = extract_captured_values(®ex, "I have 3")
.expect("example ensures fallible call succeeds");
assert_eq!(captures, vec!["3".to_string()]);