1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

cp: copy dir if source path ends with dot (#7874)

This commit is contained in:
Daniel Hofstetter 2025-05-04 09:31:34 +02:00 committed by GitHub
parent f49e120877
commit cd3c921d1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 48 deletions

View file

@ -291,6 +291,24 @@ fn test_cp_recurse_several() {
assert_eq!(at.read(TEST_COPY_TO_FOLDER_NEW_FILE), "Hello, World!\n");
}
#[test]
fn test_cp_recurse_source_path_ends_with_slash_dot() {
let source_dir = "source_dir";
let target_dir = "target_dir";
let file = "file";
let (at, mut ucmd) = at_and_ucmd!();
at.mkdir(source_dir);
at.touch(format!("{source_dir}/{file}"));
ucmd.arg("-r")
.arg(format!("{source_dir}/."))
.arg(target_dir)
.succeeds()
.no_output();
assert!(at.file_exists(format!("{target_dir}/{file}")));
}
#[test]
fn test_cp_with_dirs_t() {
let (at, mut ucmd) = at_and_ucmd!();