hello/tests/cli.rs

14 lines364 bytesCodeBlame
1use std::process::Command;
2
3#[test]
4fn version_flag_prints_crate_version() {
5 let output = Command::new(env!("CARGO_BIN_EXE_hello"))
6 .arg("--version")
7 .output()
8 .unwrap();
9 assert!(output.status.success());
10 assert_eq!(
11 String::from_utf8(output.stdout).unwrap(),
12 format!("{}\n", env!("CARGO_PKG_VERSION"))
13 );
14}