use std::fs;
use std::path::PathBuf;
fn release_plz_toml_path() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("..")
.join("release-plz.toml")
}
fn release_plz_toml() -> String {
let path = release_plz_toml_path();
fs::read_to_string(&path)
.unwrap_or_else(|e| panic!("read {}: {e}", path.display()))
.replace("\r\n", "\n")
}
#[test]
fn semver_check_stays_off() {
let toml = release_plz_toml();
let still_off = toml
.lines()
.map(str::trim)
.filter(|line| !line.starts_with('#'))
.map(|line| {
line.chars()
.filter(|c| !c.is_whitespace())
.collect::<String>()
})
.any(|line| line == "semver_check=false");
assert!(
still_off,
"{} no longer sets `semver_check = false` in [workspace], so release-plz's \
release-pr run is back to recomputing a semver check the required semver-checks \
job already ran -- the ~8½-minute window that loses release-PR changelog updates \
(#412, #426, #430)",
release_plz_toml_path().display(),
);
}