mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 08:02:24 +00:00
test(lsp): use a host-shaped absolute path in the URI round-trip
`Url::from_file_path` rejects a POSIX literal on Windows, so the test panicked there instead of exercising the percent-encoding it is about.
This commit is contained in:
+8
-1
@@ -596,7 +596,14 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn uri_round_trips_paths_with_spaces() {
|
||||
let p = Path::new("/tmp/a dir/file.rs");
|
||||
// `Url::from_file_path` requires an *absolute* path in the host's own
|
||||
// shape, so a POSIX literal here would simply fail to convert on
|
||||
// Windows rather than exercise the percent-encoding under test.
|
||||
let p = if cfg!(windows) {
|
||||
Path::new(r"C:\tmp\a dir\file.rs")
|
||||
} else {
|
||||
Path::new("/tmp/a dir/file.rs")
|
||||
};
|
||||
let uri = uri_for_path(p).unwrap();
|
||||
assert!(uri.starts_with("file:///"));
|
||||
assert!(uri.contains("a%20dir"));
|
||||
|
||||
Reference in New Issue
Block a user