use assert_cmd::Command;
fn cmd() -> Command {
Command::cargo_bin("arborist").unwrap()
}
#[test]
fn exit_code_1_threshold_exceeded() {
cmd()
.args(["tests/fixtures/complex.rs", "--threshold", "5"])
.assert()
.code(1);
}
#[test]
fn exit_code_0_nothing_exceeds() {
cmd()
.args(["tests/fixtures/simple.rs", "--threshold", "100"])
.assert()
.code(0);
}
#[test]
fn exit_code_error_precedence_over_threshold() {
cmd()
.args([
"tests/fixtures/complex.rs",
"nonexistent_file.rs",
"--threshold",
"5",
])
.assert()
.code(2);
}
#[test]
fn exit_code_2_on_error() {
cmd().arg("nonexistent.rs").assert().code(2);
}