//! The published pack (`joule-ui/conformance/lang/v1/`) is exactly what the //! reference implementation gives: every file regenerated and compared byte for //! byte, and no file in the directory that the pack does not hold. use std::path::PathBuf; #[test] fn the_published_pack_is_what_the_implementation_gives() { let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../../conformance/lang/v1"); let pack = joule_ui_lang::vectors::pack(); for (name, bytes) in &pack { let on_disk = std::fs::read(dir.join(name)).unwrap_or_else(|e| panic!("{name}: {e} (regenerate with `cargo run -p joule-ui-lang --bin gen_lang_vectors`)")); assert!(on_disk == *bytes, "{name} differs from what the implementation gives (regenerate with `cargo run -p joule-ui-lang --bin gen_lang_vectors`)"); } let mut listed: Vec = std::fs::read_dir(&dir).unwrap().map(|e| e.unwrap().file_name().to_string_lossy().into_owned()).collect(); listed.sort(); let mut expected: Vec = pack.into_iter().map(|(n, _)| n).collect(); expected.sort(); assert_eq!(listed, expected, "the pack directory holds exactly the pack"); }