1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

mv: show prompt for -u --interactive

This commit is contained in:
Daniel Hofstetter 2025-01-20 10:47:47 +01:00
parent 6c26b4c2df
commit 20eb5466c0
2 changed files with 24 additions and 7 deletions

View file

@ -1119,6 +1119,30 @@ fn test_mv_arg_update_older_dest_older() {
assert_eq!(at.read(old), new_content);
}
#[test]
fn test_mv_arg_update_older_dest_older_interactive() {
let (at, mut ucmd) = at_and_ucmd!();
let old = "old";
let new = "new";
let old_content = "file1 content\n";
let new_content = "file2 content\n";
let mut f = at.make_file(old);
f.write_all(old_content.as_bytes()).unwrap();
f.set_modified(std::time::UNIX_EPOCH).unwrap();
at.write(new, new_content);
ucmd.arg(new)
.arg(old)
.arg("--interactive")
.arg("--update=older")
.fails()
.stderr_contains("overwrite 'old'?")
.no_stdout();
}
#[test]
fn test_mv_arg_update_short_overwrite() {
// same as --update=older