use assert_cmd::prelude::*; use predicates::prelude::*; use std::process::Command; #[test] fn file_doesnt_exist() -> Result<(), Box> { let mut cmd = Command::cargo_bin("grrs")?; cmd.arg("foo").arg("baz.rs"); cmd.assert() .failure() .stderr(predicate::str::contains("Could not read file")); Ok(()) }