#[must_use]
pub fn changelog_text() -> &'static str {
include_str!("../changelog-embed/CHANGELOG.md")
}
#[cfg(test)]
mod tests {
use super::changelog_text;
#[test]
fn the_embedded_changelog_is_nonempty_and_leads_with_the_title() {
let text = changelog_text();
assert!(
text.starts_with("# Changelog"),
"the embedded changelog must lead with its title heading; got: {:?}",
text.lines().next()
);
assert!(
text.contains("\n## "),
"the embedded changelog must contain at least one release section"
);
}
#[test]
fn changelog_embed_matches_the_authored_document() -> Result<(), std::io::Error> {
let authored_path =
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../CHANGELOG.md");
let authored = std::fs::read_to_string(&authored_path)?;
assert_eq!(
changelog_text(),
authored,
"changelog-embed/CHANGELOG.md has drifted from the authored \
CHANGELOG.md at the repository root; sync it with: \
cp CHANGELOG.md crates/aion-server/changelog-embed/CHANGELOG.md"
);
Ok(())
}
}