diff --git a/rcrypto-sys/build.rs b/rcrypto-sys/build.rs index e9e83cf..ca5b047 100644 --- a/rcrypto-sys/build.rs +++ b/rcrypto-sys/build.rs @@ -37,14 +37,19 @@ fn update_tests() { } let test_name = fname.strip_suffix(".c").unwrap().replace('-', "_"); - let exe_path = format!( - "{out_dir}/c-out/test_{test_name}.{EXE_EXTENSION}", - out_dir = out_dir.to_string_lossy() - ); + let mut exe_path = out_dir.clone(); + exe_path.extend(["c-out", &format!("test_{test_name}.{EXE_EXTENSION}")]); + let exe_path_str = exe_path.to_string_lossy(); + let exe_path_str = exe_path_str.replace(r"\", r"\\"); + // escape backslashes + // let exe_path = format!( + // "{out_dir}/c-out/test_{test_name}.{EXE_EXTENSION}", + // out_dir = out_dir.to_string_lossy() + // ); - write!( + indoc::writedoc!( to_write, - indoc! {" + " #[test] fn test_{test_name}() {{ @@ -52,9 +57,9 @@ fn update_tests() { let mut cmd = Command::new(\"{exe_path}\"); run_cmd_else_quit(&mut cmd, \"{fname}\"); }} - "}, + ", test_name = test_name, - exe_path = exe_path, + exe_path = exe_path_str, fname = fname, ) .unwrap();