mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-16 09:48:10 +00:00
cfg gated tests that only work on windows.
This commit is contained in:
parent
2e2fae32df
commit
40116af598
1 changed files with 17 additions and 11 deletions
|
@ -325,16 +325,22 @@ fn url_from_path_with_drive_lowercasing(path: impl AsRef<Path>) -> Result<Url> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
// `Url` is not able to parse windows paths on unix machines.
|
||||||
fn test_lowercase_drive_letter_with_drive() {
|
#[cfg(target_os = "windows")]
|
||||||
let url = url_from_path_with_drive_lowercasing("C:\\Test").unwrap();
|
#[cfg(test)]
|
||||||
|
mod path_conversion_windows_tests {
|
||||||
|
use super::url_from_path_with_drive_lowercasing;
|
||||||
|
#[test]
|
||||||
|
fn test_lowercase_drive_letter_with_drive() {
|
||||||
|
let url = url_from_path_with_drive_lowercasing("C:\\Test").unwrap();
|
||||||
|
|
||||||
assert_eq!(url.to_string(), "file:///c:/Test");
|
assert_eq!(url.to_string(), "file:///c:/Test");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_drive_without_colon_passthrough() {
|
fn test_drive_without_colon_passthrough() {
|
||||||
let url = url_from_path_with_drive_lowercasing(r#"\\localhost\C$\my_dir"#).unwrap();
|
let url = url_from_path_with_drive_lowercasing(r#"\\localhost\C$\my_dir"#).unwrap();
|
||||||
|
|
||||||
assert_eq!(url.to_string(), "file://localhost/C$/my_dir");
|
assert_eq!(url.to_string(), "file://localhost/C$/my_dir");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue