xll-utils 0.1.0

PE/COFF parsing and export verification utilities for Excel XLL development
Documentation
#[cfg(feature = "build")]
mod build_tests {
    use xll_utils::build::{rerun_if_dll_changed, verify_exports_in_build};

    fn fixture_path() -> std::path::PathBuf {
        std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
            .join("tests")
            .join("fixtures")
            .join("test_xll.xll")
    }

    #[test]
    fn verify_exports_all_present() {
        let expected = &["xlAutoOpen", "xlAutoClose", "xlAutoFree12"];
        verify_exports_in_build(fixture_path(), expected).unwrap();
    }

    #[test]
    fn verify_exports_missing() {
        let expected = &["xlAutoOpen", "nonExistentFunction"];
        let err = verify_exports_in_build(fixture_path(), expected).unwrap_err();
        assert!(matches!(err, xll_utils::Error::MissingExport(_)));
        let msg = err.to_string();
        assert!(msg.contains("nonExistentFunction"), "error should name the missing export: {msg}");
    }

    #[test]
    fn verify_exports_nonexistent_file() {
        let err = verify_exports_in_build("no_such.xll", &["xlAutoOpen"]).unwrap_err();
        assert!(matches!(err, xll_utils::Error::FileOpen { .. }));
    }

    #[test]
    fn rerun_directive_does_not_panic() {
        // Just verifies it doesn't panic; output goes to stdout.
        rerun_if_dll_changed(fixture_path());
    }
}