use-go 0.0.1

Feature-gated facade crate for RustUse Go ecosystem primitives
Documentation
#![forbid(unsafe_code)]
#![doc = include_str!("../README.md")]

pub mod prelude;

#[cfg(feature = "version")]
pub mod version {
    pub use use_go_version::*;
}

#[cfg(feature = "identifier")]
pub mod identifier {
    pub use use_go_identifier::*;
}

#[cfg(feature = "keyword")]
pub mod keyword {
    pub use use_go_keyword::*;
}

#[cfg(feature = "value")]
pub mod value {
    pub use use_go_value::*;
}

#[cfg(feature = "package")]
pub mod package {
    pub use use_go_package::*;
}

#[cfg(feature = "import")]
pub mod import {
    pub use use_go_import::*;
}

#[cfg(feature = "module")]
pub mod module {
    pub use use_go_module::*;
}

#[cfg(feature = "go-mod")]
pub mod go_mod {
    pub use use_go_mod::*;
}

#[cfg(feature = "go-work")]
pub mod go_work {
    pub use use_go_work::*;
}

#[cfg(feature = "test")]
pub mod test {
    pub use use_go_test::*;
}

#[cfg(feature = "identifier")]
pub use use_go_identifier::*;
#[cfg(feature = "import")]
pub use use_go_import::*;
#[cfg(feature = "keyword")]
pub use use_go_keyword::*;
#[cfg(feature = "go-mod")]
pub use use_go_mod::*;
#[cfg(feature = "module")]
pub use use_go_module::*;
#[cfg(feature = "package")]
pub use use_go_package::*;
#[cfg(feature = "test")]
pub use use_go_test::*;
#[cfg(feature = "value")]
pub use use_go_value::*;
#[cfg(feature = "version")]
pub use use_go_version::*;
#[cfg(feature = "go-work")]
pub use use_go_work::*;

#[cfg(all(test, feature = "full"))]
mod tests {
    use super::{
        GoIdentifier, GoImportPath, GoKeyword, GoModConfigFile, GoModulePath, GoPackageName,
        GoPrimitiveValue, GoTestName, GoVersion, GoWorkConfigFile,
    };

    #[test]
    fn facade_reexports_every_child_crate() -> Result<(), Box<dyn std::error::Error>> {
        let version: GoVersion = "1.22".parse()?;
        let identifier = GoIdentifier::new("ServeHTTP")?;
        let keyword: GoKeyword = "func".parse()?;
        let value = GoPrimitiveValue::Bool(false);
        let package = GoPackageName::new("http")?;
        let import = GoImportPath::new("net/http")?;
        let module = GoModulePath::new("example.com/project")?;
        let config: GoModConfigFile = "go.mod".parse()?;
        let work: GoWorkConfigFile = "go.work".parse()?;
        let test = GoTestName::new("TestHandler")?;

        assert_eq!(version.major(), 1);
        assert_eq!(identifier.as_str(), "ServeHTTP");
        assert_eq!(keyword.to_string(), "func");
        assert!(value.is_zero_like());
        assert_eq!(package.as_str(), "http");
        assert_eq!(import.as_str(), "net/http");
        assert_eq!(module.as_str(), "example.com/project");
        assert_eq!(config.to_string(), "go.mod");
        assert_eq!(work.to_string(), "go.work");
        assert_eq!(test.as_str(), "TestHandler");
        Ok(())
    }
}