use std::process::Command; use assert_cmd::prelude::*; #[test] fn run_with_defaults() -> Result<(), Box> { Command::cargo_bin("chickensay") .expect("binary exists") .assert() .success() .stdout(predicates::str::contains("Cluck")); Ok(()) } #[test] fn fail_on_non_existing_file() -> Result<(), Box> { Command::cargo_bin("chickensay") .expect("binary exists") .args(&["-f", "no/such"]) .assert() .failure(); Ok(()) }