use std::{error::Error, process::Command}; // Run progams use assert_cmd::prelude::*; // Add methods on commands use predicates::prelude::*; // Used for writing assertions #[test] fn run_with_defaults() -> Result<(), Box> { Command::cargo_bin("catsay") .expect("binary exists") .assert() .success() .stdout(predicate::str::contains("Meow")); Ok(()) } fn fail_on_nonexisting_file() -> Result<(), Box> { Command::cargo_bin("catsay") .expect("binary exists") .args(&["-cf", "no/such/file.txt"]) .assert() .failure(); Ok(()) }