From 2410c1164daadcc793d6eb7f90d79c20e1b4f3e4 Mon Sep 17 00:00:00 2001 From: Skia Date: Tue, 9 Sep 2025 13:18:20 +0200 Subject: [PATCH] tests: add test_binary_version as a poor safeguard --- tests/integration_bin.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/integration_bin.rs b/tests/integration_bin.rs index 6da8b30..6d8fd61 100644 --- a/tests/integration_bin.rs +++ b/tests/integration_bin.rs @@ -5,6 +5,23 @@ use utils::Sway; static SWAYSOME_BIN: &str = env!("CARGO_BIN_EXE_swaysome"); +// Poor safeguard that the tests are actually testing the right version, in +// case there is some confusion with a swaysome installed from the system. That +// obviously does not always worked, but has saved me a couple of times already 🙃 +#[test] +fn test_binary_version() { + let output = Command::new(SWAYSOME_BIN) + .args(["--version"]) + .env_clear() + .env("SWAYSOCK", "/dev/null") + .output() + .expect("Couldn't run swaysome"); + assert_eq!( + String::from_utf8(output.stdout).unwrap(), + format!("swaysome {}\n", env!("CARGO_PKG_VERSION")) + ); +} + // This is useful when working on swapping argument parsing libraries. #[test] fn test_binary_help() {