mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
fixing tests for windows
This commit is contained in:
parent
fe7874af90
commit
c372fb3495
1 changed files with 9 additions and 2 deletions
|
@ -103,8 +103,15 @@ fn replace_root(s: &mut String, direction: bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn replace_fake_sys_root(s: &mut String) {
|
fn replace_fake_sys_root(s: &mut String) {
|
||||||
let root = get_test_path("fake-sysroot");
|
let fake_sysroot_path = get_test_path("fake-sysroot");
|
||||||
*s = s.replace(root.to_str().expect("expected str"), "$FAKESYSROOT$")
|
let fake_sysroot_path = if cfg!(windows) {
|
||||||
|
let normalized_path =
|
||||||
|
fake_sysroot_path.to_str().expect("expected str").replace(r#"\"#, r#"\\"#);
|
||||||
|
format!(r#"{}\\"#, normalized_path)
|
||||||
|
} else {
|
||||||
|
format!("{}/", fake_sysroot_path.to_str().expect("expected str"))
|
||||||
|
};
|
||||||
|
*s = s.replace(&fake_sysroot_path, "$FAKESYSROOT$")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_test_path(file: &str) -> PathBuf {
|
fn get_test_path(file: &str) -> PathBuf {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue