//! Guards that fermata's Cargo.toml carries the metadata required for //! `cargo publish` and a useful `cargo install`. Reads the manifest as //! plain text to avoid pulling cargo internals. use std::fs; fn manifest() -> String { fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/Cargo.toml")) .expect("read Cargo.toml") } #[test] fn has_license() { let m = manifest(); assert!(m.contains("license ="), "Cargo.toml missing `license` field"); } #[test] fn has_repository() { let m = manifest(); assert!(m.contains("repository ="), "Cargo.toml missing `repository` field"); } #[test] fn has_description() { let m = manifest(); assert!(m.contains("description ="), "Cargo.toml missing `description`"); } #[test] fn has_readme() { let m = manifest(); assert!(m.contains("readme ="), "Cargo.toml missing `readme` field"); } #[test] fn has_keywords_and_categories() { let m = manifest(); assert!(m.contains("keywords ="), "Cargo.toml missing `keywords`"); assert!(m.contains("categories ="), "Cargo.toml missing `categories`"); } #[test] fn has_rust_version() { let m = manifest(); assert!(m.contains("rust-version ="), "Cargo.toml missing `rust-version` (MSRV)"); }