Refactor parse_prefix on Windows

Refactor `get_first_two_components` to `get_next_component`.

Fixes the following behaviour of `parse_prefix`:
 - series of separator bytes in a prefix are correctly parsed as a single separator
 - device namespace prefixes correctly recognize both `\\` and `/` as separators
This commit is contained in:
Christiaan Dirkx
2020-11-03 19:26:31 +01:00
parent a601302ff0
commit 94d73d4403
4 changed files with 140 additions and 83 deletions

View File

@@ -873,12 +873,12 @@ pub fn test_decompositions_windows() {
);
t!("\\\\.\\foo/bar",
iter: ["\\\\.\\foo/bar", "\\"],
iter: ["\\\\.\\foo", "\\", "bar"],
has_root: true,
is_absolute: true,
parent: None,
file_name: None,
file_stem: None,
parent: Some("\\\\.\\foo/"),
file_name: Some("bar"),
file_stem: Some("bar"),
extension: None
);