Skip to main content

load_cases

Function load_cases 

Source
pub fn load_cases<Setup, Expect>(
    dir: &Path,
) -> Result<Vec<EvalCase<Setup, Expect>>, EvalError>
where Setup: DeserializeOwned + Default, Expect: DeserializeOwned,
Expand description

Load every *.ron case file from dir, parsing each via parse_cases_from_str and flattening the results — so a directory may freely mix single-case and multi-case files.

Files are read in sorted order so report ordering is deterministic across runs and machines, and a multi-case file contributes its cases in authored order. A malformed .ron is a hard error naming the file, so a typo fails the load (and any CI load test) rather than silently dropping a case. Non-.ron entries and subdirectories are ignored.

Setup: Default is required because EvalCase::setup is #[serde(default)] (a case may omit it).

Errors as EvalError::Io (naming the directory/file that couldn’t be read) or EvalError::RonParse (naming the malformed file).