mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
cp: Create backup before hardlink
This commit is contained in:
parent
87e582b5e0
commit
45751e9e48
2 changed files with 23 additions and 0 deletions
|
@ -1444,3 +1444,17 @@ fn test_cp_archive_on_nonexistent_file() {
|
|||
"cp: cannot stat 'nonexistent_file.txt': No such file or directory (os error 2)",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cp_link_backup() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.touch("file2");
|
||||
ucmd.arg("-l")
|
||||
.arg("-b")
|
||||
.arg(TEST_HELLO_WORLD_SOURCE)
|
||||
.arg("file2")
|
||||
.succeeds();
|
||||
|
||||
assert!(at.file_exists("file2~"));
|
||||
assert_eq!(at.read("file2"), "Hello, World!\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue