use crate::utils::TestDirectory;
use std::fs::remove_dir_all;
#[test]
fn test_directory_new() {
let test_dir = TestDirectory::new();
assert!(test_dir.exists(), "directory should exist after new");
}
#[test]
fn test_directory_drop() {
let path = {
let test_dir = TestDirectory::new();
assert!(test_dir.exists());
test_dir.to_path_buf()
};
assert!(!path.exists(), "directory should be deleted after drop");
}
#[test]
fn test_directory_keep() {
let path = {
let test_dir = TestDirectory::new().keep();
assert!(test_dir.exists());
test_dir.to_path_buf()
};
assert!(path.exists(), "directory should still exist after drop");
remove_dir_all(&path).expect("cleanup");
}
#[test]
fn test_directory_output() {
let test_dir = TestDirectory::new();
let output = test_dir.output();
assert!(output.ends_with("output"));
assert!(output.starts_with(&test_dir));
}
#[test]
fn test_directory_cache() {
let test_dir = TestDirectory::new();
let cache = test_dir.cache();
assert!(cache.ends_with("cache"));
assert!(cache.starts_with(&test_dir));
}
#[test]
fn test_directory_deref() {
let test_dir = TestDirectory::new();
let joined = test_dir.join("subdir");
assert!(joined.starts_with(&test_dir));
}