Expand description
Predicate grammar + evaluator for if = conditions in step definitions.
§Grammar
| Form | Meaning |
|---|---|
command_exists:<name> | command is on PATH |
env:VAR | env var is present (any value, including empty) |
env:VAR=value | env var is present and equals value |
platform:linux / platform:macos / platform:windows | current OS |
file_exists:<path> | path exists after ${VAR} resolution |
!<predicate> | negation of any of the above |
a,b,c | logical AND; whitespace around commas is allowed |
Negation binds tighter than AND. An empty predicate string evaluates to
Ok(true) (vacuously true). OR (||) is not supported yet — tracked as a
follow-up.
Structs§
- Default
Predicate Env - Production
PredicateEnvbacked by the real OS. - Mock
Predicate Env - Test double for
PredicateEnv.
Enums§
- Predicate
Error - Everything that can go wrong while parsing or evaluating a predicate string.
Traits§
- Predicate
Env - Environment abstraction used by the predicate evaluator.
Functions§
- default_
predicate_ evaluator - Wrap a
PredicateEnvinto the closure signature expected bycrate::runner::execute_steps. - eval
- Evaluate a predicate string against the supplied environment.