use tree_type::GenericDir;
use tree_type::GenericFile;
use tree_type::GenericPath;
#[test]
fn test_generic_file_display() {
let temp = tempfile::tempdir().unwrap();
let file_path = temp.path().join("test.txt");
std::fs::write(&file_path, "content").unwrap();
let file = GenericFile::new(&file_path).unwrap();
let display_output = format!("{}", file);
assert!(display_output.ends_with("test.txt"));
}
#[test]
fn test_generic_file_debug() {
let temp = tempfile::tempdir().unwrap();
let file_path = temp.path().join("test.txt");
std::fs::write(&file_path, "content").unwrap();
let file = GenericFile::new(&file_path).unwrap();
let debug_output = format!("{:?}", file);
assert!(debug_output.contains("GenericFile"));
assert!(debug_output.contains("test.txt"));
}
#[test]
fn test_generic_dir_display() {
let temp = tempfile::tempdir().unwrap();
let dir = GenericDir::new(temp.path()).unwrap();
let display_output = format!("{}", dir);
assert!(!display_output.is_empty());
}
#[test]
fn test_generic_dir_debug() {
let temp = tempfile::tempdir().unwrap();
let dir = GenericDir::new(temp.path()).unwrap();
let debug_output = format!("{:?}", dir);
assert!(debug_output.contains("GenericDir"));
}
#[test]
fn test_generic_path_display_file() {
let temp = tempfile::tempdir().unwrap();
let file_path = temp.path().join("test.txt");
std::fs::write(&file_path, "content").unwrap();
let path = GenericPath::try_from(file_path.as_path()).unwrap();
let display_output = format!("{}", path);
assert!(display_output.ends_with("test.txt"));
}
#[test]
fn test_generic_path_debug_file() {
let temp = tempfile::tempdir().unwrap();
let file_path = temp.path().join("test.txt");
std::fs::write(&file_path, "content").unwrap();
let path = GenericPath::try_from(file_path.as_path()).unwrap();
let debug_output = format!("{:?}", path);
assert!(debug_output.contains("GenericPath::File"));
assert!(debug_output.contains("test.txt"));
}
#[test]
fn test_generic_path_display_dir() {
let temp = tempfile::tempdir().unwrap();
let path = GenericPath::try_from(temp.path()).unwrap();
let display_output = format!("{}", path);
assert!(!display_output.is_empty());
}
#[test]
fn test_generic_path_debug_dir() {
let temp = tempfile::tempdir().unwrap();
let path = GenericPath::try_from(temp.path()).unwrap();
let debug_output = format!("{:?}", path);
assert!(debug_output.contains("GenericPath::Dir"));
}