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

date: show error when reading dirs for -f arg (#4572)

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
This commit is contained in:
Surya Teja K 2023-03-29 11:19:14 +05:30 committed by GitHub
parent d7bc324979
commit b14d19770f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 10 deletions

View file

@ -283,6 +283,16 @@ fn test_date_for_invalid_file() {
);
}
#[test]
fn test_date_for_dir_as_file() {
let result = new_ucmd!().arg("--file").arg("/").fails();
result.no_stdout();
assert_eq!(
result.stderr_str().trim(),
"date: expected file, got directory '/'",
);
}
#[test]
fn test_date_for_file() {
let (at, mut ucmd) = at_and_ucmd!();