mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
cp: add test for --attributes-only
This commit is contained in:
parent
12cff46f1c
commit
9f5db29145
1 changed files with 30 additions and 0 deletions
|
@ -3499,3 +3499,33 @@ fn test_cp_dest_no_permissions() {
|
||||||
.stderr_contains("invalid_perms.txt")
|
.stderr_contains("invalid_perms.txt")
|
||||||
.stderr_contains("denied");
|
.stderr_contains("denied");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(all(unix, not(target_os = "freebsd")))]
|
||||||
|
fn test_cp_attributes_only() {
|
||||||
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
let a = "file_a";
|
||||||
|
let b = "file_b";
|
||||||
|
let mode_a = 0o0500;
|
||||||
|
let mode_b = 0o0777;
|
||||||
|
|
||||||
|
at.write(a, "a");
|
||||||
|
at.write(b, "b");
|
||||||
|
at.set_mode(a, mode_a);
|
||||||
|
at.set_mode(b, mode_b);
|
||||||
|
|
||||||
|
let mode_a = at.metadata(a).mode();
|
||||||
|
let mode_b = at.metadata(b).mode();
|
||||||
|
|
||||||
|
// --attributes-only doesn't do anything without other attribute preservation flags
|
||||||
|
ucmd.arg("--attributes-only")
|
||||||
|
.arg(a)
|
||||||
|
.arg(b)
|
||||||
|
.succeeds()
|
||||||
|
.no_output();
|
||||||
|
|
||||||
|
assert_eq!("a", at.read(a));
|
||||||
|
assert_eq!("b", at.read(b));
|
||||||
|
assert_eq!(mode_a, at.metadata(a).mode());
|
||||||
|
assert_eq!(mode_b, at.metadata(b).mode());
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue