1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

install: fixes issue #7795

This commit is contained in:
Zachary Goff-Hodges 2025-04-25 03:48:50 -07:00
parent 18db15e4e6
commit 827d0fcee9
No known key found for this signature in database
GPG key ID: A8FC202749781C66
2 changed files with 39 additions and 0 deletions

View file

@ -1778,3 +1778,33 @@ fn test_install_failing_copy_file_to_target_contain_subdir_with_same_name() {
.fails()
.stderr_contains("cannot overwrite directory");
}
#[test]
fn test_install_same_file() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "file";
at.touch(file);
ucmd.arg(file)
.arg(".")
.fails()
.stderr_contains("'file' and './file' are the same file");
}
#[test]
fn test_install_symlink_same_file() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "file";
let target_dir = "target_dir";
let target_link = "target_link";
at.mkdir(target_dir);
at.touch(format!("{target_dir}/{file}"));
at.symlink_file(target_dir, target_link);
ucmd.arg(format!("{target_dir}/{file}"))
.arg(target_link)
.fails()
.stderr_contains(format!(
"'{target_dir}/{file}' and '{target_link}/{file}' are the same file"
));
}