diff options
| author | Chris Denton <christophersdenton@gmail.com> | 2022-03-05 18:15:58 +0000 |
|---|---|---|
| committer | Chris Denton <christophersdenton@gmail.com> | 2022-03-05 18:15:58 +0000 |
| commit | 3009eec10da01b7dc052891369a16346604ed50b (patch) | |
| tree | 3031464fa28d5594fc926d0dc0fafe0f15b7b2dd /library/std/src/path | |
| parent | 27f6d2c7f6a608497f8737a6e3605df8c993ee22 (diff) | |
| download | rust-3009eec10da01b7dc052891369a16346604ed50b.tar.gz rust-3009eec10da01b7dc052891369a16346604ed50b.zip | |
Use as_os_str to compare exact paths
Diffstat (limited to 'library/std/src/path')
| -rw-r--r-- | library/std/src/path/tests.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/library/std/src/path/tests.rs b/library/std/src/path/tests.rs index 09a900b5bc0..3a393ea8380 100644 --- a/library/std/src/path/tests.rs +++ b/library/std/src/path/tests.rs @@ -1731,11 +1731,11 @@ fn test_windows_absolute() { let relative = r"a\b"; let mut expected = crate::env::current_dir().unwrap(); expected.push(relative); - assert_eq!(absolute(relative).unwrap(), expected); + assert_eq!(absolute(relative).unwrap().as_os_str(), expected.as_os_str()); macro_rules! unchanged( ($path:expr) => { - assert_eq!(absolute($path).unwrap(), Path::new($path)); + assert_eq!(absolute($path).unwrap().as_os_str(), Path::new($path).as_os_str()); } ); @@ -1751,7 +1751,10 @@ fn test_windows_absolute() { // Verbatim paths are always unchanged, no matter what. unchanged!(r"\\?\path.\to/file.."); - assert_eq!(absolute(r"C:\path..\to.\file.").unwrap(), Path::new(r"C:\path..\to\file")); + assert_eq!( + absolute(r"C:\path..\to.\file.").unwrap().as_os_str(), + Path::new(r"C:\path..\to\file").as_os_str() + ); assert_eq!(absolute(r"COM1").unwrap().as_os_str(), Path::new(r"\\.\COM1").as_os_str()); } |
