mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
tests/mv: add tests to check for copying symlinks onto hardlinks to symlink
This commit is contained in:
parent
fa11315ce7
commit
269ffc12b4
1 changed files with 29 additions and 0 deletions
|
@ -465,6 +465,35 @@ fn test_mv_same_symlink() {
|
||||||
.stderr_is(format!("mv: '{file_c}' and '{file_a}' are the same file\n",));
|
.stderr_is(format!("mv: '{file_c}' and '{file_a}' are the same file\n",));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(all(unix, not(target_os = "android")))]
|
||||||
|
fn test_mv_hardlink_to_symlink() {
|
||||||
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
let file = "file";
|
||||||
|
let symlink_file = "symlink";
|
||||||
|
let hardlink_to_symlink_file = "hardlink_to_symlink";
|
||||||
|
|
||||||
|
at.touch(file);
|
||||||
|
at.symlink_file(file, symlink_file);
|
||||||
|
at.hard_link(symlink_file, hardlink_to_symlink_file);
|
||||||
|
|
||||||
|
ucmd.arg(symlink_file).arg(hardlink_to_symlink_file).fails();
|
||||||
|
|
||||||
|
let (at2, mut ucmd2) = at_and_ucmd!();
|
||||||
|
|
||||||
|
at2.touch(file);
|
||||||
|
at2.symlink_file(file, symlink_file);
|
||||||
|
at2.hard_link(symlink_file, hardlink_to_symlink_file);
|
||||||
|
|
||||||
|
ucmd2
|
||||||
|
.arg("--backup")
|
||||||
|
.arg(symlink_file)
|
||||||
|
.arg(hardlink_to_symlink_file)
|
||||||
|
.succeeds();
|
||||||
|
assert!(!at2.symlink_exists(symlink_file));
|
||||||
|
assert!(at2.symlink_exists(&format!("{hardlink_to_symlink_file}~")));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(all(unix, not(target_os = "android")))]
|
#[cfg(all(unix, not(target_os = "android")))]
|
||||||
fn test_mv_same_hardlink_backup_simple() {
|
fn test_mv_same_hardlink_backup_simple() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue