use std::path::Path;
use super::join_posix;
fn join(path1: impl AsRef<Path>, path2: impl AsRef<Path>) -> String {
join_posix(path1, path2).to_str().unwrap().to_owned()
}
#[test]
fn join_plain_names() {
assert_eq!(join("here","man"), "here/man");
}
#[test]
fn join_to_root() {
assert_eq!(join("/root","man"), "/root/man");
}
#[test]
fn join_updir_to_root() {
assert_eq!(join("/root","./../../man"), "/man");
}
#[test]
fn second_have_updir() {
assert_eq!(join("here","../man"), "man");
}
#[test]
fn both_empty() {
assert_eq!(join("",""), "");
}
#[test]
fn second_empty() {
assert_eq!(join("first",""), "first");
}
#[test]
fn second_is_dot() {
assert_eq!(join("first","."), "first/");
}
#[test]
fn first_is_dot() {
assert_eq!(join(".","second"), "second");
}
#[test]
fn second_empty_result_normalized() {
assert_eq!(join("././first",""), "first");
}
#[test]
fn absolute_second() {
assert_eq!(join("something","/root"), "/root");
}
#[test]
fn absolute_both() {
assert_eq!(join("/first","/second"), "/second");
}
#[test]
fn normalized_relative_from_curdir_test() {
assert_eq!(join("././here/.","././we"), "here/we");
}