From a7eeddab5a95d018bdff9730905d8c3d6624709b Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 25 Jan 2022 17:23:28 +0900 Subject: [PATCH] Re-add --version flag that was accidentally removed in 0.33.0 --- src/app.rs | 1 + tests/test.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/test.rs diff --git a/src/app.rs b/src/app.rs index 8376479..f66fea8 100644 --- a/src/app.rs +++ b/src/app.rs @@ -698,6 +698,7 @@ impl window::State for AppState { /// URDF visualizer #[derive(Parser, Debug, Deserialize)] +#[clap(version)] #[serde(rename_all = "kebab-case")] #[non_exhaustive] pub struct Opt { diff --git a/tests/test.rs b/tests/test.rs new file mode 100644 index 0000000..bfe0922 --- /dev/null +++ b/tests/test.rs @@ -0,0 +1,14 @@ +use std::process::Command; + +#[test] +fn version() { + let output = Command::new(env!("CARGO_BIN_EXE_urdf-viz")) + .arg("--version") + .output() + .unwrap(); + assert!(output.status.success()); + assert_eq!( + String::from_utf8(output.stdout).unwrap().trim(), + format!("urdf-viz {}", env!("CARGO_PKG_VERSION")) + ); +}