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

mv: 'mv source hardlink' should fail

fixes: tests/mv/force.sh
This commit is contained in:
Sylvestre Ledru 2023-05-06 00:24:42 +02:00
parent b7cf825887
commit a5a39b6ba8
3 changed files with 20 additions and 2 deletions

View file

@ -400,6 +400,23 @@ fn test_mv_same_file() {
.stderr_is(format!("mv: '{file_a}' and '{file_a}' are the same file\n",));
}
#[test]
#[cfg(unix)]
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]
fn test_mv_same_file_not_dot_dir() {
let (at, mut ucmd) = at_and_ucmd!();