mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Merge pull request #4831 from sylvestre/mv-hardlink
mv: 'mv source hardlink' should fail
This commit is contained in:
commit
d769871374
4 changed files with 185 additions and 81 deletions
|
@ -400,6 +400,39 @@ fn test_mv_same_file() {
|
|||
.stderr_is(format!("mv: '{file_a}' and '{file_a}' are the same file\n",));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(all(unix, not(target_os = "android")))]
|
||||
fn test_mv_same_hardlink() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let file_a = "test_mv_same_file_a";
|
||||
let file_b = "test_mv_same_file_b";
|
||||
at.touch(file_a);
|
||||
|
||||
at.hard_link(file_a, file_b);
|
||||
|
||||
at.touch(file_a);
|
||||
ucmd.arg(file_a)
|
||||
.arg(file_b)
|
||||
.fails()
|
||||
.stderr_is(format!("mv: '{file_a}' and '{file_b}' are the same file\n",));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(all(unix, not(target_os = "android")))]
|
||||
fn test_mv_same_hardlink_backup_simple() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let file_a = "test_mv_same_file_a";
|
||||
let file_b = "test_mv_same_file_b";
|
||||
at.touch(file_a);
|
||||
|
||||
at.hard_link(file_a, file_b);
|
||||
|
||||
ucmd.arg(file_a)
|
||||
.arg(file_b)
|
||||
.arg("--backup=simple")
|
||||
.succeeds();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mv_same_file_not_dot_dir() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue