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

chown: show message if file doesn't exist

* print the message "failed to change ownership of" when we try to change a non existing file.

* replace the 4-tuple returned by parse_gid_uid_and_filter by GidUidOwnerFilter struct.

* chain the test in one expression.

* chown: remove unused var "result" in test

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
Moïse Valvassori 2023-05-21 17:54:32 +02:00 committed by GitHub
parent 70765eea82
commit 0130a07579
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 20 deletions

View file

@ -730,15 +730,15 @@ fn test_chown_file_notexisting() {
let user_name = String::from(result.stdout_str().trim());
assert!(!user_name.is_empty());
let _result = scene
scene
.ucmd()
.arg(user_name)
.arg(&user_name)
.arg("--verbose")
.arg("not_existing")
.fails();
// TODO: uncomment once "failed to change ownership of '{}' to {}" added to stdout
// result.stderr_contains("retained as");
.fails()
.stdout_contains(format!(
"failed to change ownership of 'not_existing' to {user_name}"
));
// TODO: uncomment once message changed from "cannot dereference" to "cannot access"
// result.stderr_contains("cannot access 'not_existing': No such file or directory");
}