Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Add --version flag that prints the crate version and exits | 1 | use std::process::Command; |
| 2 | ||
| 3 | #[test] | |
| 4 | fn 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 | } |