pub mod adopt;
#[cfg(feature = "ollama")]
pub mod assay;
pub mod cli;
pub mod code;
pub mod debt;
pub mod fed;
pub mod git;
pub mod land;
pub mod lens;
pub mod plan;
pub mod review;
pub mod slice;
pub mod spec;
pub mod split;
pub mod state;
#[cfg(test)]
pub mod testrepo;
pub mod tokens;
pub mod wave;
#[cfg(feature = "ollama")]
pub mod ollama;
#[cfg(feature = "ollama")]
pub mod tdd;
#[cfg(test)]
mod tests {
fn path_deps(manifest: &str) -> Vec<&str> {
manifest
.lines()
.filter(|l| {
l.contains("path = \"") && !l.trim_start().starts_with("path")
})
.filter_map(|l| l.split_once(' ').map(|(name, _)| name))
.collect()
}
fn unrecorded<'a>(manifest: &'a str, allowed: &[&str]) -> Vec<&'a str> {
path_deps(manifest)
.into_iter()
.filter(|name| !allowed.contains(name))
.collect()
}
#[test]
fn path_deps_are_only_what_the_list_records() {
const ALLOWED: &[&str] = &[];
let manifest =
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml");
let text =
std::fs::read_to_string(&manifest).expect("Cargo.toml is readable");
let found = unrecorded(&text, ALLOWED);
assert!(
found.is_empty(),
"V101: {found:?} named by path -- pin a published version, or record why not"
);
}
#[test]
fn a_path_dep_is_seen_and_a_target_path_is_not() {
let manifest = "\
[lib]
path = \"src/lib.rs\"
[dependencies]
sibling = { path = \"../sibling\" }
registry = \"1\"
";
assert_eq!(path_deps(manifest), vec!["sibling"]);
assert_eq!(unrecorded(manifest, &[]), vec!["sibling"]);
assert!(unrecorded(manifest, &["sibling"]).is_empty());
}
}