mirror of
https://github.com/uutils/findutils.git
synced 2026-06-10 15:48:30 -07:00
xargs: add more tests and priority
This commit is contained in:
+1
-1
@@ -888,7 +888,7 @@ fn do_xargs(args: &[&str]) -> Result<CommandResult, XargsError> {
|
||||
max_lines: matches.get_one::<usize>(options::MAX_LINES).copied(),
|
||||
no_run_if_empty: matches.get_flag(options::NO_RUN_IF_EMPTY),
|
||||
null: matches.get_flag(options::NULL),
|
||||
replace: [options::REPLACE, options::REPLACE_I]
|
||||
replace: [options::REPLACE_I, options::REPLACE]
|
||||
.iter()
|
||||
.find_map(|&option| {
|
||||
matches.contains_id(option).then(|| {
|
||||
|
||||
@@ -478,6 +478,21 @@ fn xargs_replace() {
|
||||
.assert()
|
||||
.stdout(predicate::str::contains("foo bar foo"));
|
||||
|
||||
// other order
|
||||
Command::cargo_bin("xargs")
|
||||
.expect("found binary")
|
||||
.args(["-i", "-I=_", "echo", "{} bar {}"])
|
||||
.write_stdin("foo")
|
||||
.assert()
|
||||
.stdout(predicate::str::contains("{} bar {}"));
|
||||
|
||||
Command::cargo_bin("xargs")
|
||||
.expect("found binary")
|
||||
.args(["-i", "-I", "_", "echo", "{} bar _"])
|
||||
.write_stdin("foo")
|
||||
.assert()
|
||||
.stdout(predicate::str::contains("{} bar foo"));
|
||||
|
||||
// Expected to fail
|
||||
Command::cargo_bin("xargs")
|
||||
.expect("found binary")
|
||||
|
||||
Reference in New Issue
Block a user