tree-type 0.4.5

Rust macros for creating type-safe filesystem tree structures
Documentation
#![allow(deprecated)]

use std::fs;
use tree_type::tree_type;

#[test]
#[cfg(unix)]
fn test_nested_path_symlink() {
    tree_type! {
        TestRoot {
            a/ {
                b/ {
                    c/ {
                        #[default("nested content")]
                        target("target.txt")
                    }
                }
            },
            links/ {
                #[symlink(/a/b/c/target)]
                deep_link("link.txt")
            }
        }
    }

    let temp_dir = tempfile::tempdir().unwrap();
    let root = TestRoot::new(temp_dir.path()).unwrap();

    // Create the target file
    root.a().b().c().target().write("nested content").unwrap();

    // Create the structure (including symlink)
    root.sync().unwrap();

    // Verify symlink was created
    let link = root.links().deep_link();
    assert!(link.exists(), "Nested path symlink should exist");

    // Verify it's a symlink
    let metadata = fs::symlink_metadata(link.as_path()).unwrap();
    assert!(metadata.is_symlink(), "Should be a symlink");

    // Verify content is accessible through symlink
    let content = link.read_to_string().unwrap();
    assert_eq!(content, "nested content");
}