@@ -31,16 +31,6 @@ fn test_parse_next_component() {
31
31
parse_next_component(OsStr::new(r"servershare"), false),
32
32
(OsStr::new(r"servershare"), OsStr::new(""))
33
33
);
34
-
35
- assert_eq!(
36
- parse_next_component(OsStr::new(r"server/\//\/\\\\/////\/share"), false),
37
- (OsStr::new(r"server"), OsStr::new(r"share"))
38
- );
39
-
40
- assert_eq!(
41
- parse_next_component(OsStr::new(r"server\\\\\\\\\\\\\\share"), true),
42
- (OsStr::new(r"server"), OsStr::new(r"\\\\\\\\\\\\\share"))
43
- );
44
34
}
45
35
46
36
#[test]
@@ -126,3 +116,22 @@ fn test_windows_prefix_components() {
126
116
assert_eq!(drive.as_os_str(), OsStr::new("C:"));
127
117
assert_eq!(components.as_path(), Path::new(""));
128
118
}
119
+
120
+ /// See #101358.
121
+ ///
122
+ /// Note that the exact behaviour here may change in the future.
123
+ /// In which case this test will need to adjusted.
124
+ #[test]
125
+ fn broken_unc_path() {
126
+ use crate::path::Component;
127
+
128
+ let mut components = Path::new(r"\\foo\\bar\\").components();
129
+ assert_eq!(components.next(), Some(Component::RootDir));
130
+ assert_eq!(components.next(), Some(Component::Normal("foo".as_ref())));
131
+ assert_eq!(components.next(), Some(Component::Normal("bar".as_ref())));
132
+
133
+ let mut components = Path::new("//foo//bar//").components();
134
+ assert_eq!(components.next(), Some(Component::RootDir));
135
+ assert_eq!(components.next(), Some(Component::Normal("foo".as_ref())));
136
+ assert_eq!(components.next(), Some(Component::Normal("bar".as_ref())));
137
+ }
0 commit comments