scheme-edit 0.2.0

Lossless Scheme S-expression parser and editor (toml_edit-style CST)
Documentation
use scheme_edit::Document;
use std::{fs, path::Path};

#[test]
fn every_fixture_roundtrips_byte_identical() {
    let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures");
    let mut checked = 0;
    for dir in ["channels", "system", "packages", "services", "configs"] {
        for entry in fs::read_dir(root.join(dir)).unwrap() {
            let path = entry.unwrap().path();
            let src = fs::read_to_string(&path).unwrap();
            let doc = Document::parse(&src).unwrap_or_else(|e| panic!("{}: {e}", path.display()));
            assert_eq!(
                doc.to_string(),
                src,
                "{} not byte-identical",
                path.display()
            );
            checked += 1;
        }
    }
    assert!(checked >= 35, "expected full corpus, got {checked}");
}