diff --git a/tests/ui/Cargo.toml b/tests/ui/Cargo.toml index 1fef31ac..3d601d03 100644 --- a/tests/ui/Cargo.toml +++ b/tests/ui/Cargo.toml @@ -18,3 +18,5 @@ log = "0.4" predicates = "1" pretty_assertions = "0.6" semver = "0.9" +version = "3" + diff --git a/tests/ui/src/imag_header.rs b/tests/ui/src/imag_header.rs index 5119689e..3f87b300 100644 --- a/tests/ui/src/imag_header.rs +++ b/tests/ui/src/imag_header.rs @@ -21,6 +21,7 @@ use std::process::Command; use assert_cmd::prelude::*; use assert_fs::fixture::TempDir; +use predicates::prelude::*; pub fn binary(tempdir: &TempDir) -> Command { crate::imag::binary(tempdir, "imag-header") @@ -40,3 +41,23 @@ fn test_no_header_besides_version_after_creation() { bin.assert().success(); } +#[test] +fn test_imag_version_as_semver_string() { + crate::setup_logging(); + let imag_home = crate::imag::make_temphome(); + crate::imag_init::call(&imag_home); + crate::imag_create::call(&imag_home, &["test"]); + + let imag_version = version::version!(); + + let mut bin = binary(&imag_home); + bin.arg("test"); + bin.arg("string"); + bin.arg("imag.version"); + + let expected_output_str = format!("test - {}", imag_version); + bin.assert() + .stdout(predicate::eq(expected_output_str.as_bytes())) + .success(); +} +