dev-fixtures 0.9.3

Repeatable test environments, sample data, and controlled inputs. Part of the dev-* verification suite.
Documentation
//! Build a `TempProject` — a self-cleaning temporary directory pre-populated
//! with files — and emit a `Report` describing the lifecycle.
//!
//! ```text
//! cargo run --example temp_project
//! ```
//!
//! The temp directory is removed when `project` is dropped. The example
//! prints the staged paths, asserts they exist on disk, then drops the
//! handle and confirms the cleanup.

use std::fs;

use dev_fixtures::TempProject;

fn main() {
    let project = TempProject::new()
        .with_file(
            "Cargo.toml",
            "[package]\nname = \"sample\"\nversion = \"0.1.0\"\n",
        )
        .with_file("src/lib.rs", "pub fn answer() -> u32 { 42 }\n")
        .with_file(
            "README.md",
            "# sample\n\nGenerated by the dev-fixtures example.\n",
        )
        .with_bytes("assets/payload.bin", vec![0u8, 1, 2, 3, 4, 5])
        .build()
        .expect("build temp project");

    println!("temp project root: {}", project.path().display());
    for (rel, bytes) in project.declared_files() {
        let absolute = project.path().join(rel);
        let read_ok = fs::metadata(&absolute).is_ok();
        println!(
            "  {:>4} bytes — declared {:?} — exists on disk: {}",
            bytes.len(),
            rel,
            read_ok
        );
    }

    let kept_root = project.path().to_path_buf();
    drop(project);
    println!(
        "after drop: {} still on disk? {}",
        kept_root.display(),
        kept_root.exists()
    );
}