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

cp: always delete the destination for symlinks

This commit is contained in:
Michael Debertol 2021-06-19 17:49:04 +02:00
parent 6400cded54
commit 9fb927aa85
2 changed files with 18 additions and 0 deletions

View file

@ -1325,3 +1325,16 @@ fn test_copy_dir_with_symlinks() {
ucmd.args(&["-r", "dir", "copy"]).succeeds();
assert_eq!(at.resolve_link("copy/file-link"), "file");
}
#[test]
#[cfg(not(windows))]
fn test_copy_symlink_force() {
let (at, mut ucmd) = at_and_ucmd!();
at.touch("file");
at.symlink_file("file", "file-link");
at.touch("copy");
ucmd.args(&["file-link", "copy", "-f", "--no-dereference"])
.succeeds();
assert_eq!(at.resolve_link("copy"), "file");
}