mcpspy 0.2.4

Zero-config stdio MCP proxy, latency profiler, and token usage auditor in Rust
Documentation
//! CLI version flag tests.
//!
//! Spawn the compiled binary so the assertions cover the actual process
//! behavior users see, not just clap's parse result.

use std::process::Command;

fn run_version(arg: &str) -> (bool, String, String) {
    let output = Command::new(env!("CARGO_BIN_EXE_mcpspy"))
        .arg(arg)
        .output()
        .expect("failed to run mcpspy version flag");
    (
        output.status.success(),
        String::from_utf8_lossy(&output.stdout).trim().to_string(),
        String::from_utf8_lossy(&output.stderr).trim().to_string(),
    )
}

#[test]
fn long_version_flag_prints_name_and_package_version() {
    let (ok, stdout, stderr) = run_version("--version");
    assert!(ok, "--version exited unsuccessfully; stderr: {stderr}");
    assert_eq!(stdout, format!("mcpspy {}", env!("CARGO_PKG_VERSION")));
}

#[test]
fn short_version_flag_prints_name_and_package_version() {
    let (ok, stdout, stderr) = run_version("-V");
    assert!(ok, "-V exited unsuccessfully; stderr: {stderr}");
    assert_eq!(stdout, format!("mcpspy {}", env!("CARGO_PKG_VERSION")));
}