tree-type-proc-macro 0.2.0

Procedural macros for tree-type crate
Documentation
#![expect(deprecated)]

use tempfile::TempDir;
use tree_type_proc_macro::tree_type;

tree_type! {
    ComprehensiveTest {
        // Basic file
        #[required]
        #[default("content")]
        readme,

        // File with custom filename
        config(".config"),

        // File with custom type
        license as LicenseFile,

        // File with default
        #[default]
        gitignore(".gitignore"),

        // File with required
        #[required]
        manifest("Cargo.toml"),

        // Directory
        src/ {
            lib,
            main
        },

        // Directory with custom filename
        build/("target"),

        // Symlink
        #[symlink(readme)]
        link,

        // Dynamic ID
        [task_id: String]/ as TaskDir {
            description,
            status
        }
    }
}

#[test]
fn test_comprehensive_compilation() {
    let tempdir = TempDir::new().unwrap();
    let root = ComprehensiveTest::new(tempdir.path()).unwrap();

    // Verify all navigation methods exist
    let _readme = root.readme();
    let _config = root.config();
    let _license = root.license();
    let _gitignore = root.gitignore();
    let _manifest = root.manifest();
    let _src = root.src();
    let _build = root.build();
    let _link = root.link();
    let _task = root.task_id("task-1");
}

#[test]
fn test_setup_and_validation() {
    let tempdir = TempDir::new().unwrap();
    let root = ComprehensiveTest::new(tempdir.path()).unwrap();

    // Create required file first
    std::fs::create_dir_all(tempdir.path()).unwrap();
    std::fs::write(root.manifest().as_path(), "").unwrap();

    // Setup should create structure
    root.setup().unwrap();

    // Verify default file was created
    assert!(root.gitignore().exists());

    // Verify directories were created
    assert!(root.src().exists());
    assert!(root.build().exists());
}