summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-10-20 12:25:13 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-11-02 18:19:30 +0100
commita8b75ad2ba2ec04ac9ec0f317f87659e15cb4a78 (patch)
tree4f405dfc8d55223ebb8f34d8c237fcd8840fe2e9
parentfd2afad72a045e2fb1bfbd44062a5c30ee0631be (diff)
Refactor out helper function to simply get stdout of a command
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--tests/ui/src/imag.rs2
-rw-r--r--tests/ui/src/imag_ids.rs10
2 files changed, 2 insertions, 10 deletions
diff --git a/tests/ui/src/imag.rs b/tests/ui/src/imag.rs
index 094a0dfe..3c517ce2 100644
--- a/tests/ui/src/imag.rs
+++ b/tests/ui/src/imag.rs
@@ -42,7 +42,7 @@ pub fn binary(tempdir: &TempDir, binary_name: &str) -> Command {
/// Run the passed command and get the stdout of it.
///
/// This function does _not_ ensure that stdin is inherited.
-pub fn stdout_of_command(command: Command) -> Vec<String> {
+pub fn stdout_of_command(mut command: Command) -> Vec<String> {
let assert = command.assert();
let lines = String::from_utf8(assert.get_output().stdout.clone())
.unwrap()
diff --git a/tests/ui/src/imag_ids.rs b/tests/ui/src/imag_ids.rs
index 2c38906e..f6351eb6 100644
--- a/tests/ui/src/imag_ids.rs
+++ b/tests/ui/src/imag_ids.rs
@@ -29,15 +29,7 @@ pub fn call(tempdir: &TempDir) -> Vec<String> {
// 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
+ crate::imag::stdout_of_command(binary)
}
pub fn binary(tempdir: &TempDir) -> Command {