use std::process::Command;
const BIN: &str = env!("CARGO_BIN_EXE_pathlint");
#[test]
fn version_output_matches_cargo_pkg_version() {
let out = Command::new(BIN)
.arg("--version")
.output()
.expect("failed to run pathlint");
let stdout = String::from_utf8_lossy(&out.stdout);
assert!(
stdout.contains(env!("CARGO_PKG_VERSION")),
"version output `{}` must contain {}",
stdout.trim(),
env!("CARGO_PKG_VERSION")
);
assert!(
stdout.starts_with("pathlint "),
"version output must start with `pathlint `: {}",
stdout.trim()
);
}
#[test]
fn help_lists_every_canonical_subcommand() {
let out = Command::new(BIN)
.arg("--help")
.output()
.expect("failed to run pathlint");
let stdout = String::from_utf8_lossy(&out.stdout);
for sc in ["check", "init", "catalog", "doctor", "trace", "sort"] {
assert!(
stdout.contains(sc),
"subcommand `{sc}` missing from --help: {stdout}"
);
}
}
#[test]
fn help_surfaces_where_alias_for_trace() {
let out = Command::new(BIN)
.arg("--help")
.output()
.expect("failed to run pathlint");
let stdout = String::from_utf8_lossy(&out.stdout);
assert!(
stdout.contains("where"),
"trace alias `where` must surface in --help: {stdout}"
);
}