Skip to main content

parse_steps

Function parse_steps 

Source
pub fn parse_steps(
    steps: &[(&str, &str, Vec<Vec<String>>)],
) -> Result<Vec<Predicate>, PredicateError>
Expand description

Parse Gherkin steps into semantic predicates.

Analyzes the text of Given/Then steps using pattern matching to extract structured predicates. Steps that don’t match known patterns produce Predicate::Custom (no error).

Data tables attached to steps are parsed for forbidden terms and required field specifications.

§Examples

use converge_tool::predicate::{parse_steps, Predicate};

let steps = vec![
    ("Then", r#"the Context key "Strategies" contains at least 2 facts"#, vec![]),
];
let predicates = parse_steps(&steps).unwrap();
assert!(matches!(&predicates[0], Predicate::CountAtLeast { key, min: 2 } if key == "Strategies"));