Skip to content

Commit 71c1b00

Browse files
committed
Add test for systemd escape logic
Signed-off-by: Davide Cavalca <[email protected]>
1 parent e9e24ea commit 71c1b00

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,15 @@ WantedBy=multi-user.target",
105105

106106
Ok(())
107107
}
108+
109+
#[cfg(test)]
110+
mod tests {
111+
use super::*;
112+
113+
#[test]
114+
fn test_systemd_escape_path() {
115+
let path = Path::new("/foo/bar/fex-emu/rootfs");
116+
let escaped = systemd_escape_path(path);
117+
assert_eq!(escaped, "foo-bar-fex\\x2demu-rootfs.mount");
118+
}
119+
}

0 commit comments

Comments
 (0)