Skip to main content

Module predicate

Module predicate 

Source
Expand description

Predicate grammar + evaluator for if = conditions in step definitions.

§Grammar

FormMeaning
command_exists:<name>command is on PATH
env:VARenv var is present (any value, including empty)
env:VAR=valueenv var is present and equals value
platform:linux / platform:macos / platform:windowscurrent OS
file_exists:<path>path exists after ${VAR} resolution
!<predicate>negation of any of the above
a,b,clogical 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§

DefaultPredicateEnv
Production PredicateEnv backed by the real OS.
MockPredicateEnv
Test double for PredicateEnv.

Enums§

PredicateError
Everything that can go wrong while parsing or evaluating a predicate string.

Traits§

PredicateEnv
Environment abstraction used by the predicate evaluator.

Functions§

default_predicate_evaluator
Wrap a PredicateEnv into the closure signature expected by crate::runner::execute_steps.
eval
Evaluate a predicate string against the supplied environment.