mind-body: pin the --instance guard and the binary's refusal exit
Two cargo-mutants survivors from the first run (main -> (), and the --instance match guard -> true) are killed by a malformed-command table row and a process-level test of the refused invocation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
76367e888a
commit
9a9165d4f1
1 changed files with 11 additions and 0 deletions
|
|
@ -83,6 +83,8 @@ fn malformed_commands_are_refused_and_write_nothing() {
|
|||
&["--instance", "eureka", "dial", "set", "--heat", "1", "--base-cooldown-s", "60", "--base-run-usd", "1", "--extra", "1"],
|
||||
&["--instance", "eureka", "dial", "set", "--heat"],
|
||||
&["--instance", "../evil", "brake", "release"],
|
||||
&["--instances", "eureka", "brake", "release"],
|
||||
&["eureka", "eureka", "brake", "release"],
|
||||
];
|
||||
for args in bad {
|
||||
assert!(go(root.path(), args, "op", 0).0.is_err(), "{args:?}");
|
||||
|
|
@ -99,3 +101,12 @@ fn the_operator_is_sudo_user_then_user_then_unknown() {
|
|||
assert_eq!(operator_name(None, s("")), "unknown");
|
||||
assert_eq!(operator_name(None, None), "unknown");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_binary_exits_nonzero_with_the_usage_when_refused() {
|
||||
// A refusal before any path is derived, so this never reaches /etc.
|
||||
let output = std::process::Command::new(env!("CARGO_BIN_EXE_mind-control")).output().unwrap();
|
||||
assert_eq!(output.status.code(), Some(2));
|
||||
assert!(String::from_utf8_lossy(&output.stderr).contains("usage: mind-control"));
|
||||
assert!(output.stdout.is_empty());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue