diff options
-rw-r--r-- | crates/ra_lsp_server/src/world.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index 63a820012..8b48726ee 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs | |||
@@ -325,16 +325,22 @@ fn url_from_path_with_drive_lowercasing(path: impl AsRef<Path>) -> Result<Url> { | |||
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
328 | #[test] | 328 | // `Url` is not able to parse windows paths on unix machines. |
329 | fn test_lowercase_drive_letter_with_drive() { | 329 | #[cfg(target_os = "windows")] |
330 | let url = url_from_path_with_drive_lowercasing("C:\\Test").unwrap(); | 330 | #[cfg(test)] |
331 | 331 | mod path_conversion_windows_tests { | |
332 | assert_eq!(url.to_string(), "file:///c:/Test"); | 332 | use super::url_from_path_with_drive_lowercasing; |
333 | } | 333 | #[test] |
334 | fn test_lowercase_drive_letter_with_drive() { | ||
335 | let url = url_from_path_with_drive_lowercasing("C:\\Test").unwrap(); | ||
336 | |||
337 | assert_eq!(url.to_string(), "file:///c:/Test"); | ||
338 | } | ||
334 | 339 | ||
335 | #[test] | 340 | #[test] |
336 | fn test_drive_without_colon_passthrough() { | 341 | fn test_drive_without_colon_passthrough() { |
337 | let url = url_from_path_with_drive_lowercasing(r#"\\localhost\C$\my_dir"#).unwrap(); | 342 | let url = url_from_path_with_drive_lowercasing(r#"\\localhost\C$\my_dir"#).unwrap(); |
338 | 343 | ||
339 | assert_eq!(url.to_string(), "file://localhost/C$/my_dir"); | 344 | assert_eq!(url.to_string(), "file://localhost/C$/my_dir"); |
345 | } | ||
340 | } | 346 | } |