mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #5699 from sylvestre/mv-cp-seen
cp/mv/ln: add support for the "will not overwrite just-created"
This commit is contained in:
commit
f10c6f1d56
6 changed files with 211 additions and 15 deletions
|
@ -3592,3 +3592,36 @@ 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 ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
|
||||
at.mkdir("a");
|
||||
at.mkdir("b");
|
||||
at.mkdir("c");
|
||||
at.write("a/f", "a");
|
||||
at.write("b/f", "b");
|
||||
|
||||
let result = ts.ucmd().arg("a/f").arg("b/f").arg("c").fails();
|
||||
#[cfg(not(unix))]
|
||||
assert!(result
|
||||
.stderr_str()
|
||||
.contains("will not overwrite just-created 'c\\f' with 'b/f'"));
|
||||
#[cfg(unix)]
|
||||
assert!(result
|
||||
.stderr_str()
|
||||
.contains("will not overwrite just-created 'c/f' with 'b/f'"));
|
||||
|
||||
assert!(at.plus("c").join("f").exists());
|
||||
|
||||
ts.ucmd()
|
||||
.arg("--backup=numbered")
|
||||
.arg("a/f")
|
||||
.arg("b/f")
|
||||
.arg("c")
|
||||
.succeeds();
|
||||
assert!(at.plus("c").join("f").exists());
|
||||
assert!(at.plus("c").join("f.~1~").exists());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue