icedwright-semantics 0.0.2

The icedwright semantic tree: inference from recorded widget operations, stable node paths, hit testing, diffs and YAML
Documentation
use std::path::PathBuf;

#[test]
fn compile_fail() -> std::io::Result<()> {
    let mut cases: Vec<PathBuf> = std::fs::read_dir("tests/compile_fail")?
        .map(|entry| entry.map(|e| e.path()))
        .collect::<Result<_, _>>()?;
    cases.retain(|path| path.extension().is_some_and(|ext| ext == "rs"));
    cases.sort();

    let tests = trybuild::TestCases::new();
    for case in &cases {
        let is_pass = case
            .file_name()
            .and_then(|name| name.to_str())
            .is_some_and(|name| name.starts_with("pass_"));
        if is_pass {
            tests.pass(case);
        } else {
            tests.compile_fail(case);
        }
    }
    Ok(())
}