INNER CODE UNIT · Rust
check_install_requires_tools
ngless-toolkit/ngless · src/lib.rs:388
fn check_install_requires_tools() {
let found = |name: &'static str, required| (name, required, Ok(format!("/bin/{name}")));
let missing = |name: &'static str, required| {
(name, required, Err(errors::NgError::script("missing")))
};
assert_eq!(check_tools([found("bwa", true)].into_iter(), true), 0);
// A missing optional tool (minimap2) is only a warning.
assert_eq!(
check_tools(
[found("bwa", true), missing("minimap2", false)].into_iter(),
false
),
0
);
assert_eq!(
check_tools(
[missing("bwa", true), found("minimap2", false)].into_iter(),
true