run_rust_candidate

Function run_rust_candidate 

Source
pub fn run_rust_candidate(
    program: &Path,
    args: &[&str],
    cwd: &Path,
    home: &Path,
) -> CmdOutput
Expand description

Executes the Ito candidate binary with the supplied arguments in a deterministic test environment and returns the captured output.

The command is run with a stable set of environment variables (e.g. color and interactivity disabled, HOME and XDG_DATA_HOME set) and with repository-scoped Git environment variables removed to make outputs suitable for snapshot testing.

Returns a CmdOutput containing the process exit code, captured stdout, and captured stderr.

§Examples

use std::path::Path;

// Run the candidate binary and capture output for assertions or snapshots.
let out = run_rust_candidate(
    Path::new("target/debug/ito"),
    &["--version"],
    Path::new("."),
    Path::new("/home/example"),
);
assert!(out.stdout.contains("ito"));