From 830ca8c04daeead90da98c8b05133eca78279870 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 3 Jan 2016 14:16:12 +0100 Subject: [PATCH] tests: add UCommand::env() --- tests/common/util.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/common/util.rs b/tests/common/util.rs index 43bf43986..7b7f970c4 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -311,6 +311,15 @@ impl UCommand { self.raw.args(args.as_ref()); Box::new(self) } + + pub fn env(&mut self, key: K, val: V) -> Box<&mut UCommand> where K: AsRef, V: AsRef { + if self.has_run { + panic!(ALREADY_RUN); + } + self.raw.env(key, val); + Box::new(self) + } + pub fn run(&mut self) -> CmdResult { self.has_run = true; log_info("run", &self.comm_string);