mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Don't panic when calling cp -a with a nonexistent file
This commit is contained in:
parent
5dd7d13cbd
commit
680e9081fe
2 changed files with 16 additions and 4 deletions
|
@ -26,6 +26,7 @@ use std::thread::sleep;
|
|||
use std::time::Duration;
|
||||
|
||||
static TEST_EXISTING_FILE: &str = "existing_file.txt";
|
||||
static TEST_NONEXISTENT_FILE: &str = "nonexistent_file.txt";
|
||||
static TEST_HELLO_WORLD_SOURCE: &str = "hello_world.txt";
|
||||
static TEST_HELLO_WORLD_SOURCE_SYMLINK: &str = "hello_world.txt.link";
|
||||
static TEST_HELLO_WORLD_DEST: &str = "copy_of_hello_world.txt";
|
||||
|
@ -1429,3 +1430,14 @@ fn test_copy_through_dangling_symlink() {
|
|||
.fails()
|
||||
.stderr_only("cp: not writing through dangling symlink 'target'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_cp_archive_on_nonexistent_file() {
|
||||
new_ucmd!()
|
||||
.arg("-a")
|
||||
.arg(TEST_NONEXISTENT_FILE)
|
||||
.arg(TEST_EXISTING_FILE)
|
||||
.fails()
|
||||
.stderr_only("cp: cannot stat 'nonexistent_file.txt': No such file or directory (os error 2)");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue