mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
mv: gnu test case mv-n compatibility (#6599)
* uucore: add update control `none-fail` * uucore: show suggestion when parse errors occurs because of an ambiguous value * added tests for fail-none and ambiguous parse error * uucore: ambiguous value code refractor * cp: no-clobber fail silently and outputs skipped message in debug * mv: add --debug support * minor changes --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
This commit is contained in:
parent
db402875f6
commit
8a9fb84a8e
6 changed files with 147 additions and 63 deletions
|
@ -299,9 +299,9 @@ fn test_mv_interactive_no_clobber_force_last_arg_wins() {
|
|||
|
||||
scene
|
||||
.ucmd()
|
||||
.args(&[file_a, file_b, "-f", "-i", "-n"])
|
||||
.fails()
|
||||
.stderr_is(format!("mv: not replacing '{file_b}'\n"));
|
||||
.args(&[file_a, file_b, "-f", "-i", "-n", "--debug"])
|
||||
.succeeds()
|
||||
.stdout_contains("skipped 'b.txt'");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
|
@ -352,9 +352,9 @@ fn test_mv_no_clobber() {
|
|||
ucmd.arg("-n")
|
||||
.arg(file_a)
|
||||
.arg(file_b)
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.stderr_only(format!("mv: not replacing '{file_b}'\n"));
|
||||
.arg("--debug")
|
||||
.succeeds()
|
||||
.stdout_contains("skipped 'test_mv_no_clobber_file_b");
|
||||
|
||||
assert!(at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
|
@ -863,14 +863,16 @@ fn test_mv_backup_off() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_mv_backup_no_clobber_conflicting_options() {
|
||||
new_ucmd!()
|
||||
.arg("--backup")
|
||||
.arg("--no-clobber")
|
||||
.arg("file1")
|
||||
.arg("file2")
|
||||
.fails()
|
||||
.usage_error("options --backup and --no-clobber are mutually exclusive");
|
||||
fn test_mv_backup_conflicting_options() {
|
||||
for conflicting_opt in ["--no-clobber", "--update=none-fail", "--update=none"] {
|
||||
new_ucmd!()
|
||||
.arg("--backup")
|
||||
.arg(conflicting_opt)
|
||||
.arg("file1")
|
||||
.arg("file2")
|
||||
.fails()
|
||||
.usage_error("cannot combine --backup with -n/--no-clobber or --update=none-fail");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1400,10 +1402,9 @@ fn test_mv_arg_interactive_skipped_vin() {
|
|||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.touch("a");
|
||||
at.touch("b");
|
||||
ucmd.args(&["-vin", "a", "b"])
|
||||
.fails()
|
||||
.stderr_is("mv: not replacing 'b'\n")
|
||||
.no_stdout();
|
||||
ucmd.args(&["-vin", "a", "b", "--debug"])
|
||||
.succeeds()
|
||||
.stdout_contains("skipped 'b'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue