diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-12-01 15:01:52 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-12-01 15:01:52 +0100 |
commit | b272c1508cf1355924692e24859c986971996350 (patch) | |
tree | 6c2b840d97e0375a5785e756044eeaa7da84f32d | |
parent | 611fcbc7746e4a1ebaf4faec83caf1e1c78f31f3 (diff) | |
parent | f4719666538ed267557b58f4eb87c847bd1cacc0 (diff) |
Merge branch 'ui-testing-imag-view' into master
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | tests/ui/src/imag_view.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/ui/src/imag_view.rs b/tests/ui/src/imag_view.rs index 987eadc5..e7bfe5e4 100644 --- a/tests/ui/src/imag_view.rs +++ b/tests/ui/src/imag_view.rs @@ -17,3 +17,42 @@ // 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, targets: &[&str]) -> Vec<String> { + let mut binary = binary(tempdir); + + // ensure that stdin is not used by the child process + binary.stdin(std::process::Stdio::inherit()); + + binary.arg("--ignore-ids"); + + for target in targets.iter() { + binary.arg(target); + } + + debug!("Command = {:?}", binary); + crate::imag::stdout_of_command(binary) +} + +pub fn binary(tempdir: &TempDir) -> Command { + crate::imag::binary(tempdir, "imag-view") +} + +#[test] +fn test_view_empty_entry_shows_nothing() { + crate::setup_logging(); + let imag_home = crate::imag::make_temphome(); + crate::imag_init::call(&imag_home); + crate::imag_create::call(&imag_home, &["test"]); + + let out = call(&imag_home, &["test"]); + debug!("out = '{:?}'", out); + assert!(out.iter().all(|s| s.is_empty())); +} + |