1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 19:56:17 +00:00

touch: show error on -h with nonexistent file

Show an error message when running `touch -h` on a nonexistent file.
This commit is contained in:
Jeffrey Finkelstein 2022-02-10 20:51:33 -05:00
parent e818fd2b98
commit f37e78c25a
2 changed files with 25 additions and 2 deletions

View file

@ -539,3 +539,16 @@ fn test_touch_no_args() {
Try 'touch --help' for more information."##,
);
}
#[test]
fn test_no_dereference_no_file() {
new_ucmd!()
.args(&["-h", "not-a-file"])
.fails()
.stderr_contains("setting times of 'not-a-file': No such file or directory");
new_ucmd!()
.args(&["-h", "not-a-file-1", "not-a-file-2"])
.fails()
.stderr_contains("setting times of 'not-a-file-1': No such file or directory")
.stderr_contains("setting times of 'not-a-file-2': No such file or directory");
}