tests: add test_binary_version as a poor safeguard

This commit is contained in:
Skia 2025-09-09 13:18:20 +02:00
parent 3514b9cd5b
commit 2410c1164d

View file

@ -5,6 +5,23 @@ use utils::Sway;
static SWAYSOME_BIN: &str = env!("CARGO_BIN_EXE_swaysome"); 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. // This is useful when working on swapping argument parsing libraries.
#[test] #[test]
fn test_binary_help() { fn test_binary_help() {