use std::{
process::{Command, Stdio},
thread,
time::Duration,
};
#[test]
fn hen_binary_reports_version() {
let output = Command::new(env!("CARGO_BIN_EXE_hen"))
.arg("--version")
.output()
.expect("hen should execute");
assert!(output.status.success());
let stdout = String::from_utf8(output.stdout).expect("stdout should be utf-8");
assert!(stdout.starts_with("hen "));
}
#[test]
fn hen_mcp_binary_starts_and_waits_for_stdio() {
let mut child = Command::new(env!("CARGO_BIN_EXE_hen-mcp"))
.stdin(Stdio::piped())
.spawn()
.expect("hen-mcp should execute");
thread::sleep(Duration::from_millis(200));
assert!(
child
.try_wait()
.expect("child wait should succeed")
.is_none(),
"hen-mcp exited before it could accept stdio traffic"
);
let _ = child.kill();
let _ = child.wait();
}