#![allow(unused_must_use)]
use super::helpers as h;
use super::sys_common::io::tmpdir;
use crate::filesystem::primitives::rename;
use std::path::Path;
#[test]
fn rename_directory() {
let tmpdir = tmpdir();
let dir = h::dir_of(&tmpdir);
let old_path = Path::new("foo/bar/baz");
h::create_dir_all(&dir, &old_path).unwrap();
let test_file = &old_path.join("temp.txt");
h::create(&dir, test_file).unwrap();
let new_path = Path::new("quux/blat");
h::create_dir_all(&dir, &new_path).unwrap();
rename(&dir, &old_path, &dir, &new_path.join("newdir"));
assert!(h::is_dir(&dir, &new_path.join("newdir")));
assert!(h::exists(&dir, &new_path.join("newdir/temp.txt")));
}