1 #![cfg(all(windows, feature = "clock", feature = "std"))] 2 3 use std::fs; 4 use windows_bindgen::bindgen; 5 6 #[test] gen_bindings()7fn gen_bindings() { 8 let input = "src/offset/local/win_bindings.txt"; 9 let output = "src/offset/local/win_bindings.rs"; 10 let existing = fs::read_to_string(output).unwrap(); 11 12 let log = bindgen(["--etc", input]).unwrap(); 13 eprintln!("{}", log); 14 15 // Check the output is the same as before. 16 // Depending on the git configuration the file may have been checked out with `\r\n` newlines or 17 // with `\n`. Compare line-by-line to ignore this difference. 18 let new = fs::read_to_string(output).unwrap(); 19 if !new.lines().eq(existing.lines()) { 20 panic!("generated file `{}` is changed.", output); 21 } 22 } 23