diff options
| author | Lzu Tao <taolzu@gmail.com> | 2020-07-10 15:59:25 +0000 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2020-07-12 14:51:04 +0000 |
| commit | b1d6798899b7830e869d06e1ddb106a75cb61cc8 (patch) | |
| tree | ca543ff0b475327a1054967550632729fbada618 /src/libstd/sys/windows/path | |
| parent | 27a966a149f55fe29a25a2fc07e6c8a011ae3dbf (diff) | |
| download | rust-b1d6798899b7830e869d06e1ddb106a75cb61cc8.tar.gz rust-b1d6798899b7830e869d06e1ddb106a75cb61cc8.zip | |
Rewrite parse_two_comps
Diffstat (limited to 'src/libstd/sys/windows/path')
| -rw-r--r-- | src/libstd/sys/windows/path/tests.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/path/tests.rs b/src/libstd/sys/windows/path/tests.rs new file mode 100644 index 00000000000..fbac1dc1ca1 --- /dev/null +++ b/src/libstd/sys/windows/path/tests.rs @@ -0,0 +1,21 @@ +use super::*; + +#[test] +fn test_get_first_two_components() { + assert_eq!( + get_first_two_components(br"server\share", is_verbatim_sep), + Some((&b"server"[..], &b"share"[..])), + ); + + assert_eq!( + get_first_two_components(br"server\", is_verbatim_sep), + Some((&b"server"[..], &b""[..])) + ); + + assert_eq!( + get_first_two_components(br"\server\", is_verbatim_sep), + Some((&b""[..], &b"server"[..])) + ); + + assert_eq!(get_first_two_components(br"there are no separators here", is_verbatim_sep), None,); +} |
