Skip to content

Commit 16098e2

Browse files
authored
Rollup merge of rust-lang#94650 - ChrisDenton:windows-absolute-fix, r=dtolnay
Relax tests for Windows dos device names Windows 11 no longer turn paths ending with dos device names into device paths. E.g. `C:\path\to\COM1.txt` used to get turned into `\\.\COM1`. Whereas now this path is left as is. Note though that if the given path is an exact (case-insensitive) match for the string `COM1` then it'll still be converted to `\\.\COM1`.
2 parents 9fad188 + a589cd5 commit 16098e2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

std/src/path/tests.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1739,11 +1739,11 @@ fn test_windows_absolute() {
17391739
let relative = r"a\b";
17401740
let mut expected = crate::env::current_dir().unwrap();
17411741
expected.push(relative);
1742-
assert_eq!(absolute(relative).unwrap(), expected);
1742+
assert_eq!(absolute(relative).unwrap().as_os_str(), expected.as_os_str());
17431743

17441744
macro_rules! unchanged(
17451745
($path:expr) => {
1746-
assert_eq!(absolute($path).unwrap(), Path::new($path));
1746+
assert_eq!(absolute($path).unwrap().as_os_str(), Path::new($path).as_os_str());
17471747
}
17481748
);
17491749

@@ -1759,11 +1759,11 @@ fn test_windows_absolute() {
17591759
// Verbatim paths are always unchanged, no matter what.
17601760
unchanged!(r"\\?\path.\to/file..");
17611761

1762-
assert_eq!(absolute(r"C:\path..\to.\file.").unwrap(), Path::new(r"C:\path..\to\file"));
1763-
assert_eq!(absolute(r"C:\path\to\COM1").unwrap(), Path::new(r"\\.\COM1"));
1764-
assert_eq!(absolute(r"C:\path\to\COM1.txt").unwrap(), Path::new(r"\\.\COM1"));
1765-
assert_eq!(absolute(r"C:\path\to\COM1 .txt").unwrap(), Path::new(r"\\.\COM1"));
1766-
assert_eq!(absolute(r"C:\path\to\cOnOuT$").unwrap(), Path::new(r"\\.\cOnOuT$"));
1762+
assert_eq!(
1763+
absolute(r"C:\path..\to.\file.").unwrap().as_os_str(),
1764+
Path::new(r"C:\path..\to\file").as_os_str()
1765+
);
1766+
assert_eq!(absolute(r"COM1").unwrap().as_os_str(), Path::new(r"\\.\COM1").as_os_str());
17671767
}
17681768

17691769
#[bench]

0 commit comments

Comments
 (0)