zookeeper_zk/paths.rs
1/// Combine two paths into a single path, possibly inserting a '/' between them.
2pub fn make_path(parent: &str, child: &str) -> String {
3 if parent.ends_with('/') {
4 format!("{}{}", parent, child)
5 } else {
6 format!("{}/{}", parent, child)
7 }
8}
9
10#[cfg(test)]
11#[test]
12fn make_path_tests() {
13 assert_eq!("/a/b", make_path("/a", "b"));
14 assert_eq!("/a/b", make_path("/a/", "b"));
15}