summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-10-12 17:01:07 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-11-02 18:19:30 +0100
commiteb6029537abf2c15d9e8be058168e0aab98458a9 (patch)
tree1d35ea7a5ae0513ef862aaa195c8e5f01d37df7a /tests
parent966eb6d045f92370131e0c338fa6d6b89b66ad0f (diff)
Add test: check with imag-ids whether no entries exist after init
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/src/imag_ids.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/ui/src/imag_ids.rs b/tests/ui/src/imag_ids.rs
index 987eadc5..cc6ead25 100644
--- a/tests/ui/src/imag_ids.rs
+++ b/tests/ui/src/imag_ids.rs
@@ -17,3 +17,43 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
+use std::process::Command;
+
+use assert_cmd::prelude::*;
+use assert_fs::fixture::TempDir;
+use predicates::prelude::*;
+
+/// Helper to call imag-init
+pub fn call(tempdir: &TempDir) -> Vec<String> {
+ let mut binary = binary(tempdir);
+
+ // ensure that stdin is not used by the child process
+ binary.stdin(std::process::Stdio::inherit());
+
+ let assert = binary.assert();
+ let lines = String::from_utf8(assert.get_output().stdout.clone())
+ .unwrap()
+ .lines()
+ .map(String::from)
+ .collect();
+ assert.success();
+ lines
+}
+
+pub fn binary(tempdir: &TempDir) -> Command {
+ crate::imag::binary(tempdir, "imag-ids")
+}
+
+
+#[test]
+fn test_no_ids_after_init() {
+ crate::setup_logging();
+ let imag_home = crate::imag::make_temphome();
+ crate::imag_init::call(&imag_home);
+
+ binary(&imag_home)
+ .assert()
+ .success()
+ .stdout(predicate::eq(b"" as &[u8]));
+}
+