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

install: improve error message (#7794)

* friendly message install file to directory containing directory with same name

* install: test install file to directory containing directory with same name
This commit is contained in:
Zhang Wen 2025-04-21 00:45:15 +08:00 committed by GitHub
parent f92ee6a519
commit b009cae5a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View file

@ -1764,3 +1764,17 @@ fn test_install_from_stdin() {
assert!(at.file_exists(target));
assert_eq!(at.read(target), test_string);
}
#[test]
fn test_install_failing_copy_file_to_target_contain_subdir_with_same_name() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "file";
let dir1 = "dir1";
at.touch(file);
at.mkdir_all(&format!("{dir1}/{file}"));
ucmd.arg(file)
.arg(dir1)
.fails()
.stderr_contains("cannot overwrite directory");
}