diff options
| author | name1e5s <name1e5s@qq.com> | 2022-03-19 22:05:56 +0800 |
|---|---|---|
| committer | name1e5s <name1e5s@qq.com> | 2022-05-08 22:15:26 +0800 |
| commit | b87dd755ca8dd89ebb47a6f23c1c0fb656fe4d54 (patch) | |
| tree | 8312cf1ac6bb2bb2d115e7af6c91f20263188e5e /library/std/src/sys | |
| parent | 8fbd92d0b95d847c68948d8dbbfaccb470db4f92 (diff) | |
| download | rust-b87dd755ca8dd89ebb47a6f23c1c0fb656fe4d54.tar.gz rust-b87dd755ca8dd89ebb47a6f23c1c0fb656fe4d54.zip | |
fix panic in Path::strip_prefix
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/windows/path/tests.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/library/std/src/sys/windows/path/tests.rs b/library/std/src/sys/windows/path/tests.rs index 8656b04e4f4..2f7ec433bf2 100644 --- a/library/std/src/sys/windows/path/tests.rs +++ b/library/std/src/sys/windows/path/tests.rs @@ -114,3 +114,15 @@ fn test_parse_prefix_verbatim_device() { assert_eq!(prefix, parse_prefix(r"/\?\C:\windows\system32\notepad.exe")); assert_eq!(prefix, parse_prefix(r"\\?/C:\windows\system32\notepad.exe")); } + +// See #93586 for more infomation. +#[test] +fn test_windows_prefix_components() { + use crate::path::Path; + + let path = Path::new("C:"); + let mut components = path.components(); + let drive = components.next().expect("drive is expected here"); + assert_eq!(drive.as_os_str(), OsStr::new("C:")); + assert_eq!(components.as_path(), Path::new("")); +} |
