-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #3466 - RalfJung:GetFullPathNameW, r=RalfJung
add some basic support for GetFullPathNameW This is the last missing piece to make std `path::` tests work on Windows.
- Loading branch information
Showing
6 changed files
with
174 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//@compile-flags: -Zmiri-disable-isolation | ||
#![feature(absolute_path)] | ||
use std::path::{absolute, Path}; | ||
|
||
#[track_caller] | ||
fn test_absolute(in_: &str, out: &str) { | ||
assert_eq!(absolute(in_).unwrap().as_os_str(), Path::new(out).as_os_str()); | ||
} | ||
|
||
fn main() { | ||
if cfg!(unix) { | ||
test_absolute("/a/b/c", "/a/b/c"); | ||
test_absolute("/a/b/c", "/a/b/c"); | ||
test_absolute("/a//b/c", "/a/b/c"); | ||
test_absolute("//a/b/c", "//a/b/c"); | ||
test_absolute("///a/b/c", "/a/b/c"); | ||
test_absolute("/a/b/c/", "/a/b/c/"); | ||
test_absolute("/a/./b/../c/.././..", "/a/b/../c/../.."); | ||
} else if cfg!(windows) { | ||
// Test that all these are unchanged | ||
test_absolute(r"C:\path\to\file", r"C:\path\to\file"); | ||
test_absolute(r"C:\path\to\file\", r"C:\path\to\file\"); | ||
test_absolute(r"\\server\share\to\file", r"\\server\share\to\file"); | ||
test_absolute(r"\\server.\share.\to\file", r"\\server.\share.\to\file"); | ||
test_absolute(r"\\.\PIPE\name", r"\\.\PIPE\name"); | ||
test_absolute(r"\\.\C:\path\to\COM1", r"\\.\C:\path\to\COM1"); | ||
test_absolute(r"\\?\C:\path\to\file", r"\\?\C:\path\to\file"); | ||
test_absolute(r"\\?\UNC\server\share\to\file", r"\\?\UNC\server\share\to\file"); | ||
test_absolute(r"\\?\PIPE\name", r"\\?\PIPE\name"); | ||
// Verbatim paths are always unchanged, no matter what. | ||
test_absolute(r"\\?\path.\to/file..", r"\\?\path.\to/file.."); | ||
|
||
test_absolute(r"C:\path..\to.\file.", r"C:\path..\to\file"); | ||
test_absolute(r"COM1", r"\\.\COM1"); | ||
} else { | ||
panic!("unsupported OS"); | ||
} | ||
} |