mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
cp: manages the 'seen' file list before copying
Should help with tests/mv/childproof.sh
This commit is contained in:
parent
6b1f51385f
commit
837640bc02
2 changed files with 54 additions and 11 deletions
|
@ -3559,3 +3559,22 @@ fn test_cp_attributes_only() {
|
|||
assert_eq!(mode_a, at.metadata(a).mode());
|
||||
assert_eq!(mode_b, at.metadata(b).mode());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cp_seen_file() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
at.mkdir("a");
|
||||
at.mkdir("b");
|
||||
at.mkdir("c");
|
||||
at.write("a/f", "a");
|
||||
at.write("b/f", "b");
|
||||
|
||||
ucmd.arg("a/f")
|
||||
.arg("b/f")
|
||||
.arg("c")
|
||||
.fails()
|
||||
.stderr_contains("will not overwrite just-created 'c/f' with 'b/f'");
|
||||
|
||||
assert!(at.plus("c").join("f").exists());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue