Skip to content

Commit c37e448

Browse files
committed
std: tests: env: Add split_paths_uefi
- Add test for split_paths for UEFI target. - `;` is the path separator. Escaping is not supported. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
1 parent 9fe6175 commit c37e448

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

library/std/tests/env.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,23 @@ fn split_paths_unix() {
5959
assert!(check_parse("/:/usr/local", &mut ["/", "/usr/local"]));
6060
}
6161

62+
#[test]
63+
#[cfg(target_os = "uefi")]
64+
fn split_paths_uefi() {
65+
use std::path::PathBuf;
66+
67+
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
68+
split_paths(unparsed).collect::<Vec<_>>()
69+
== parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
70+
}
71+
72+
assert!(check_parse("", &mut [""]));
73+
assert!(check_parse(";;", &mut ["", "", ""]));
74+
assert!(check_parse(r"fs0:\", &mut [r"fs0:\"]));
75+
assert!(check_parse(r"fs0:\;", &mut [r"fs0:\", ""]));
76+
assert!(check_parse(r"fs0:\;fs0:\boot\", &mut [r"fs0:\", r"fs0:\boot\"]));
77+
}
78+
6279
#[test]
6380
#[cfg(unix)]
6481
fn join_paths_unix() {

0 commit comments

Comments
 (0)