Struct second_law::UCommand
[−]
[src]
pub struct UCommand { pub raw: Command, // some fields omitted }
A UCommand is a wrapper around an individual Command that provides several additional features 1. it has convenience functions that are more ergonomic to use for piping in stdin, spawning the command and asserting on the results. 2. it tracks arguments provided so that in test cases which may provide variations of an arg in loops the test failure can display the exact call which preceded an assertion failure. 3. it provides convenience construction arguments to set the Command working directory and/or clear its environment.
Fields
raw: Command
Methods
impl UCommand
[src]
fn new<T: AsRef<OsStr>, U: AsRef<OsStr>>(
invoked: T,
settings: Arc<SceneSettings>,
env_clear: bool,
curdir: Option<U>
) -> UCommand
[src]
invoked: T,
settings: Arc<SceneSettings>,
env_clear: bool,
curdir: Option<U>
) -> UCommand
fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> Box<&mut UCommand>
[src]
fn arg_fixture<S: AsRef<OsStr>>(
&mut self,
file_rel_path: S
) -> Box<&mut UCommand>
[src]
&mut self,
file_rel_path: S
) -> Box<&mut UCommand>
like arg(...), but uses the contents of the file at the provided relative path as the argument
fn args<S: AsRef<OsStr>>(&mut self, args: &[S]) -> Box<&mut UCommand>
[src]
fn pipe_in<T: Into<Vec<u8>>>(&mut self, input: T) -> Box<&mut UCommand>
[src]
provides stdinput to feed in to the command when spawned
fn pipe_in_fixture<S: AsRef<OsStr>>(
&mut self,
file_rel_path: S
) -> Box<&mut UCommand>
[src]
&mut self,
file_rel_path: S
) -> Box<&mut UCommand>
like pipe_in(...), but uses the contents of the file at the provided relative path as the piped in data
fn env<K, V>(&mut self, key: K, val: V) -> Box<&mut UCommand> where
K: AsRef<OsStr>,
V: AsRef<OsStr>,
[src]
K: AsRef<OsStr>,
V: AsRef<OsStr>,
fn run_no_wait(&mut self) -> Child
[src]
Spawns the command, feeds the stdin if any, and returns the child process immediately.
fn run(&mut self) -> CmdResult
[src]
Spawns the command, feeds the stdin if any, waits for the result and returns a command result. It is recommended that you instead use succeeds() or fails()
fn run_piped_stdin<T: Into<Vec<u8>>>(&mut self, input: T) -> CmdResult
[src]
Spawns the command, feeding the passed in stdin, waits for the result and returns a command result. It is recommended that, instead of this, you use a combination of pipe_in() with succeeds() or fails()
fn succeeds(&mut self) -> CmdResult
[src]
Spawns the command, feeds the stdin if any, waits for the result, asserts success, and returns a command result.
fn fails(&mut self) -> CmdResult
[src]
Spawns the command, feeds the stdin if any, waits for the result, asserts success, and returns a command result.