nomad_client_rs/api/
mod.rs

1pub mod acl;
2pub mod allocation;
3pub mod client;
4pub mod deployment;
5pub mod event;
6pub mod job;
7pub mod namespace;
8pub mod service;
9pub mod status;
10pub mod variable;
11
12pub fn path_combine(a: &str, b: &str) -> String {
13    let a = a.trim_end_matches('/');
14    let b = b.trim_start_matches('/');
15    format!("{}/{}", a, b)
16}
17
18#[cfg(test)]
19mod tests {
20    use crate::api::path_combine;
21
22    #[test]
23    fn path_combine_should_return_valid_path() {
24        assert_eq!("/a/b", path_combine("/a", "/b"));
25        assert_eq!("/a/b", path_combine("/a/", "/b"));
26        assert_eq!("/a/b", path_combine("/a", "b"));
27        assert_eq!("a/b", path_combine("a", "b"));
28        assert_eq!("a/b", path_combine("a", "/b"));
29    }
30}