From ae03b09c6de85df72dad1ae3415b67edc0fc91c7 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 10 Jun 2021 11:01:44 +0200 Subject: [PATCH] tests/util: add CmdResult::new() --- tests/common/util.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/common/util.rs b/tests/common/util.rs index 11425e9b8..922d2ba36 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -69,6 +69,22 @@ pub struct CmdResult { } impl CmdResult { + pub fn new( + tmpd: Option>, + code: Option, + success: bool, + stdout: &[u8], + stderr: &[u8], + ) -> CmdResult { + CmdResult { + tmpd, + code, + success, + stdout: stdout.to_vec(), + stderr: stderr.to_vec(), + } + } + /// Returns a reference to the program's standard output as a slice of bytes pub fn stdout(&self) -> &[u8] { &self.stdout