mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
cp: assume --reflink=always on no value (#3992)
* Set reflink to auto by default
This commit is contained in:
parent
a437cf0187
commit
a7b637b1eb
2 changed files with 23 additions and 1 deletions
|
@ -1334,6 +1334,24 @@ fn test_cp_reflink_auto() {
|
|||
assert_eq!(at.read(TEST_EXISTING_FILE), "Hello, World!\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(target_os = "linux", target_os = "android", target_os = "macos"))]
|
||||
fn test_cp_reflink_none() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let result = ucmd
|
||||
.arg("--reflink")
|
||||
.arg(TEST_HELLO_WORLD_SOURCE)
|
||||
.arg(TEST_EXISTING_FILE)
|
||||
.run();
|
||||
|
||||
if result.succeeded() {
|
||||
// Check the content of the destination file
|
||||
assert_eq!(at.read(TEST_EXISTING_FILE), "Hello, World!\n");
|
||||
} else {
|
||||
// Older Linux versions do not support cloning.
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(target_os = "linux", target_os = "android", target_os = "macos"))]
|
||||
fn test_cp_reflink_never() {
|
||||
|
@ -1356,7 +1374,7 @@ fn test_cp_reflink_bad() {
|
|||
.arg(TEST_HELLO_WORLD_SOURCE)
|
||||
.arg(TEST_EXISTING_FILE)
|
||||
.fails()
|
||||
.stderr_contains("invalid argument");
|
||||
.stderr_contains("error: \"bad\" isn't a valid value for '--reflink[=<WHEN>...]'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue