facett-build-thing/tests/toml_parity.rs
//! **The committed `.nornir/build-variants.toml` IS the code's emission** — byte
//! for byte.
//!
//! Not a parity mirror. The distinction is the whole 2026-08-27 law and it is worth
//! being exact about, because the shape this replaces looked identical: korp's file
//! was a HAND-MAINTAINED mirror with a parity test comparing it to `recipe.rs`, and
//! gunnar's cost two whole declaration groups going four generations unread — a
//! mirror compared against a reader that silently discards what it cannot parse
//! agrees about nothing, loudly.
//!
//! Here there is ONE declaration (`FacettBuildThing::variants`), the file is its
//! projection, and this test is the check that the writer RAN. When it fails the
//! answer is never to edit the file: it is `cargo run -p facett-build-thing -- emit`.
use nornir_build_thing::emit::first_difference;
#[test]
fn the_committed_recipe_is_the_emission() {
let path = facett_build_thing::repo_root()
.join(".nornir")
.join("build-variants.toml");
let committed = std::fs::read_to_string(&path).unwrap_or_else(|e| {
panic!(
"{} is not readable ({e}) — run `cargo run -p facett-build-thing -- emit`",
path.display()
)
});
let emitted = facett_build_thing::emitted_toml().expect("the declaration emits");
if let Some(diff) = first_difference(&committed, &emitted) {
panic!(
"{} is NOT this code's emission — {diff}\n\nThe file is emitted, not \
source: do not edit it. Re-emit with\n cargo run -p facett-build-thing -- emit",
path.display()
);
}
}