1 //! The bound bundle's recorded job: the binder, the Python engine, and one2 //! reply that must not change.3 4 use std::fs;5 use std::path::PathBuf;6 7 use inf3r_goldens::bundle::Golden;8 9 fn bin() -> PathBuf {10 PathBuf::from(env!("CARGO_BIN_EXE_inf3r-echo-x64-cpu"))11 }12 13 #[test]14 fn every_recorded_echo_golden_matches() {15 let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("goldens");16 let mut files: Vec<PathBuf> = fs::read_dir(&dir)17 .expect("the golden directory")18 .filter_map(Result::ok)19 .map(|entry| entry.path())20 .filter(|path| path.extension().is_some_and(|ext| ext == "json"))21 .collect();22 files.sort();23 assert!(!files.is_empty(), "the echo bundle ships no golden");24 for path in files {25 let golden = Golden::read(&path).unwrap_or_else(|why| panic!("{}: {why}", path.display()));26 let run = golden27 .run(bin(), None)28 .unwrap_or_else(|why| panic!("{}: {why}", path.display()));29 run.check(&golden)30 .unwrap_or_else(|why| panic!("{}: {why}\n{run:?}", path.display()));31 }32 }