#![cfg_attr(feature = "walk", allow(deprecated))]
#[cfg(feature = "walk")]
use tree_type::dir_type;
#[cfg(feature = "walk")]
use tree_type::tree_type;
#[cfg(feature = "walk")]
#[test]
fn test_dir_type_has_walk_dir() {
dir_type!(TestDir);
let temp = tempfile::tempdir().unwrap();
let test_dir = TestDir::new(temp.path()).unwrap();
let _walker = test_dir.walk_dir();
}
#[cfg(feature = "walk")]
#[test]
fn test_tree_type_root_has_walk_dir() {
tree_type! {
TestRoot {
subdir/
}
}
let temp = tempfile::tempdir().unwrap();
let root = TestRoot::new(temp.path()).unwrap();
let _walker = root.walk_dir();
}
#[cfg(feature = "walk")]
#[test]
fn test_tree_type_empty_subdir_has_walk_dir() {
tree_type! {
TestRoot2 {
empty_subdir/
}
}
let temp = tempfile::tempdir().unwrap();
let root = TestRoot2::new(temp.path()).unwrap();
let _walker = root.empty_subdir().walk_dir();
}
#[cfg(feature = "walk")]
#[test]
fn test_tree_type_subdir_with_children_has_walk_dir() {
tree_type! {
TestRoot3 {
subdir/ {
child/
}
}
}
let temp = tempfile::tempdir().unwrap();
let root = TestRoot3::new(temp.path()).unwrap();
let _walker = root.subdir().walk_dir();
}
#[cfg(feature = "walk")]
#[test]
fn test_tree_type_empty_subdir_has_size_in_bytes() {
tree_type! {
TestRoot4 {
empty_subdir/
}
}
let temp = tempfile::tempdir().unwrap();
let root = TestRoot4::new(temp.path()).unwrap();
root.sync().unwrap();
let _size = root.empty_subdir().size_in_bytes().unwrap();
}