mod common;
#[test]
fn std_is_documented() {
let public = common::public_types(&common::std_sources());
let mut missing = Vec::new();
for (name, text) in nova_std::ALL {
if common::module_docs(text).trim().is_empty() {
missing.push(format!("std/{name}: no `//!` docs"));
}
for (what, docs) in common::needing_docs(&common::parse(text), &public) {
if docs.iter().all(|l| l.value.trim().is_empty()) {
missing.push(format!("std/{name}: {what}"));
}
}
}
assert!(
missing.is_empty(),
"{} undocumented:\n{}",
missing.len(),
missing.join("\n")
);
}
#[test]
fn every_std_module_has_an_example() {
let mut missing = Vec::new();
for (name, text) in nova_std::ALL {
let tested = nova_doc::code_blocks(&common::module_docs(text))
.iter()
.any(|b| matches!(b.block, nova_doc::Block::Test { .. }));
if !tested {
missing.push(format!("std/{name}"));
}
}
assert!(
missing.is_empty(),
"{} module(s) without an example in their `//!` docs: {}",
missing.len(),
missing.join(", ")
);
}