crates/nornir-pages/tests/names_no_old_forge.rs
//! **The pages flow names no old forge** (A28 L17 / A29-23): the constellation left Codeberg, so
//! `nordisk.codeberg.page` serves nothing of ours. The flow's docs, its banner and its fixtures
//! name a pages host as the caller's knob (`PagesConfig::pages_url`, `pages_host`), never that
//! one. The callers' live hosts are theirs.
use std::path::Path;
fn sources(dir: &Path, out: &mut Vec<std::path::PathBuf>) {
for e in std::fs::read_dir(dir).unwrap() {
let p = e.unwrap().path();
if p.is_dir() {
sources(&p, out);
} else if p.extension().is_some_and(|x| x == "rs" || x == "toml") {
out.push(p);
}
}
}
#[test]
fn the_pages_flow_names_no_codeberg() {
let root = Path::new(env!("CARGO_MANIFEST_DIR"));
let mut files = vec![root.join("Cargo.toml")];
sources(&root.join("src"), &mut files);
let me = file!().rsplit('/').next().unwrap();
let hits: Vec<String> = files
.iter()
.filter(|f| !f.ends_with(me))
.flat_map(|f| {
std::fs::read_to_string(f).unwrap().lines().enumerate().filter(|(_, l)| l.to_lowercase().contains("codeberg")).map(|(n, l)| format!("{}:{}: {}", f.display(), n + 1, l.trim())).collect::<Vec<_>>()
})
.collect();
assert!(hits.is_empty(), "the pages flow still names the old forge:\n{}", hits.join("\n"));
}