Files
benilla-octo/crates/benilla-formats/tests/wow_data_env.rs
T
SamandClaude Fable 5 6b980b9efb the player build: one binary that carries its content
- a player build ships beside the dev one — dev chords and probe surfaces go dark, and a gate enforces what a player can still reach, by medium not by module
- the binary carries its own shaders and its shipped UI, finds the WoW folder by itself, and keeps its local state in one benilla-config folder
- the glue screens get a capture shutter, and the engine stops depending on the protocol crate

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 18:18:02 +07:00

37 lines
1.4 KiB
Rust

//! `$WOW_DATA` still wins — the one env read in [`benilla_formats::wow_data`], covered.
//!
//! **Why this is an integration test and not a unit test** (decision 1175): setting `$WOW_DATA` is
//! process-global, and since the sweep every test in the workspace resolves its install through
//! that one read. A unit test that mutates it poisons whatever else is running in the same test
//! binary, and the victim moves around with the thread scheduling — which is exactly what happened
//! before this was pulled out. Cargo gives each integration-test file its own process, and this
//! file holds one test, so the mutation can only reach itself.
//!
//! The ladder itself is unit-tested purely, against `candidates_from`.
#[test]
fn the_override_is_read_and_wins() {
let tmp = std::env::temp_dir().join(format!("benilla-wdenv-{}", std::process::id()));
std::fs::create_dir_all(&tmp).unwrap();
std::env::set_var("WOW_DATA", &tmp);
assert_eq!(
benilla_formats::wow_data(),
Some(tmp.clone()),
"$WOW_DATA is set to a real directory and must be the answer"
);
assert_eq!(
benilla_formats::candidates().first(),
Some(&tmp),
"$WOW_DATA must lead the ladder"
);
std::env::remove_var("WOW_DATA");
assert_ne!(
benilla_formats::wow_data(),
Some(tmp.clone()),
"unset, the override must stop being consulted"
);
std::fs::remove_dir_all(&tmp).ok();
}