Skip to content

Commit 3009eec

Browse files
committed
Use as_os_str to compare exact paths
1 parent 27f6d2c commit 3009eec

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

library/std/src/path/tests.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,11 +1731,11 @@ fn test_windows_absolute() {
17311731
let relative = r"a\b";
17321732
let mut expected = crate::env::current_dir().unwrap();
17331733
expected.push(relative);
1734-
assert_eq!(absolute(relative).unwrap(), expected);
1734+
assert_eq!(absolute(relative).unwrap().as_os_str(), expected.as_os_str());
17351735

17361736
macro_rules! unchanged(
17371737
($path:expr) => {
1738-
assert_eq!(absolute($path).unwrap(), Path::new($path));
1738+
assert_eq!(absolute($path).unwrap().as_os_str(), Path::new($path).as_os_str());
17391739
}
17401740
);
17411741

@@ -1751,7 +1751,10 @@ fn test_windows_absolute() {
17511751
// Verbatim paths are always unchanged, no matter what.
17521752
unchanged!(r"\\?\path.\to/file..");
17531753

1754-
assert_eq!(absolute(r"C:\path..\to.\file.").unwrap(), Path::new(r"C:\path..\to\file"));
1754+
assert_eq!(
1755+
absolute(r"C:\path..\to.\file.").unwrap().as_os_str(),
1756+
Path::new(r"C:\path..\to\file").as_os_str()
1757+
);
17551758
assert_eq!(absolute(r"COM1").unwrap().as_os_str(), Path::new(r"\\.\COM1").as_os_str());
17561759
}
17571760

0 commit comments

Comments
 (0)