From d545a9fe627f63b03aac3298be8f3cb85fa3060d Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Tue, 7 Feb 2017 15:55:36 -0500 Subject: [PATCH] Attempt to fix the run_with_library_paths test for Windows. I was just pasting the build directories into Rust string literals, so Windows paths with backslashes were being interpreted as having unknown string escapes. Raw string guards should fix this for all but the most pathological of build directories. --- tests/run.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/run.rs b/tests/run.rs index 8caa3c7e7e0..36d2b5a28ac 100644 --- a/tests/run.rs +++ b/tests/run.rs @@ -602,7 +602,7 @@ fn run_with_library_paths() { // Only link search directories within the target output directory are // propagated through to dylib_path_envvar() (see #3366). let mut dir1 = p.target_debug_dir(); - dir1.push("foo"); + dir1.push("foo\\backslash"); let mut dir2 = p.target_debug_dir(); dir2.push("dir=containing=equal=signs"); @@ -614,20 +614,20 @@ fn run_with_library_paths() { authors = [] build = "build.rs" "#) - .file("build.rs", &format!(r#" + .file("build.rs", &format!(r##" fn main() {{ - println!("cargo:rustc-link-search=native={}"); - println!("cargo:rustc-link-search={}"); + println!(r#"cargo:rustc-link-search=native={}"#); + println!(r#"cargo:rustc-link-search={}"#); }} - "#, dir1.display(), dir2.display())) - .file("src/main.rs", &format!(r#" + "##, dir1.display(), dir2.display())) + .file("src/main.rs", &format!(r##" fn main() {{ let search_path = std::env::var_os("{}").unwrap(); let paths = std::env::split_paths(&search_path).collect::>(); - assert!(paths.contains(&"{}".into())); - assert!(paths.contains(&"{}".into())); + assert!(paths.contains(&r#"{}"#.into())); + assert!(paths.contains(&r#"{}"#.into())); }} - "#, dylib_path_envvar(), dir1.display(), dir2.display())); + "##, dylib_path_envvar(), dir1.display(), dir2.display())); assert_that(p.cargo_process("run"), execs().with_status(0)); }