summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-10-13 13:00:07 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-11-02 18:19:30 +0100
commit4cbcdc118c36aaa32c358740627439a45d2ea200 (patch)
treeb6aca6a86ad84e01d444525e49f0264417e400f8
parent4b3e2ea4cde252f3cfeef979628f166ab0cbdd22 (diff)
Add test: Check whether imag-header prints correct string when querying imag.version header
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--tests/ui/Cargo.toml2
-rw-r--r--tests/ui/src/imag_header.rs21
2 files changed, 23 insertions, 0 deletions
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();
+}
+