mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
tests/common: create TestScenario::composite_cmd
This is made to call UCommand::new with Some(util_name)
This commit is contained in:
parent
d4ca4371d7
commit
ab4573bde9
1 changed files with 14 additions and 9 deletions
|
@ -780,9 +780,18 @@ impl TestScenario {
|
||||||
/// Returns builder for invoking the target uutils binary. Paths given are
|
/// Returns builder for invoking the target uutils binary. Paths given are
|
||||||
/// treated relative to the environment's unique temporary test directory.
|
/// treated relative to the environment's unique temporary test directory.
|
||||||
pub fn ucmd(&self) -> UCommand {
|
pub fn ucmd(&self) -> UCommand {
|
||||||
let mut cmd = self.cmd(&self.bin_path);
|
self.composite_cmd(&self.bin_path, &self.util_name, true)
|
||||||
cmd.arg(&self.util_name);
|
}
|
||||||
cmd
|
|
||||||
|
/// Returns builder for invoking the target uutils binary. Paths given are
|
||||||
|
/// treated relative to the environment's unique temporary test directory.
|
||||||
|
pub fn composite_cmd<S: AsRef<OsStr>, T: AsRef<OsStr>>(
|
||||||
|
&self,
|
||||||
|
bin: S,
|
||||||
|
util_name: T,
|
||||||
|
env_clear: bool,
|
||||||
|
) -> UCommand {
|
||||||
|
UCommand::new_from_tmp(bin, Some(util_name), self.tmpd.clone(), env_clear)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns builder for invoking any system command. Paths given are treated
|
/// Returns builder for invoking any system command. Paths given are treated
|
||||||
|
@ -794,17 +803,13 @@ impl TestScenario {
|
||||||
/// Returns builder for invoking any uutils command. Paths given are treated
|
/// Returns builder for invoking any uutils command. Paths given are treated
|
||||||
/// relative to the environment's unique temporary test directory.
|
/// relative to the environment's unique temporary test directory.
|
||||||
pub fn ccmd<S: AsRef<OsStr>>(&self, bin: S) -> UCommand {
|
pub fn ccmd<S: AsRef<OsStr>>(&self, bin: S) -> UCommand {
|
||||||
let mut cmd = self.cmd(&self.bin_path);
|
self.composite_cmd(&self.bin_path, bin, true)
|
||||||
cmd.arg(bin);
|
|
||||||
cmd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// different names are used rather than an argument
|
// different names are used rather than an argument
|
||||||
// because the need to keep the environment is exceedingly rare.
|
// because the need to keep the environment is exceedingly rare.
|
||||||
pub fn ucmd_keepenv(&self) -> UCommand {
|
pub fn ucmd_keepenv(&self) -> UCommand {
|
||||||
let mut cmd = self.cmd_keepenv(&self.bin_path);
|
self.composite_cmd(&self.bin_path, &self.util_name, false)
|
||||||
cmd.arg(&self.util_name);
|
|
||||||
cmd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns builder for invoking any system command. Paths given are treated
|
/// Returns builder for invoking any system command. Paths given are treated
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue