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

mv: add the check with --b=simple and when the source is a backup

This commit is contained in:
Sylvestre Ledru 2023-06-24 00:06:54 +02:00
parent 24aff229da
commit 40c598852b
2 changed files with 28 additions and 1 deletions

View file

@ -510,6 +510,22 @@ fn test_mv_same_hardlink_backup_simple() {
.succeeds();
}
#[test]
#[cfg(all(unix, not(target_os = "android")))]
fn test_mv_same_hardlink_backup_simple_destroy() {
let (at, mut ucmd) = at_and_ucmd!();
let file_a = "test_mv_same_file_a~";
let file_b = "test_mv_same_file_a";
at.touch(file_a);
at.touch(file_b);
ucmd.arg(file_a)
.arg(file_b)
.arg("--b=simple")
.fails()
.stderr_contains("backing up 'test_mv_same_file_a' might destroy source");
}
#[test]
fn test_mv_same_file_not_dot_dir() {
let (at, mut ucmd) = at_and_ucmd!();