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

date: fix invalid argument error for RFC 3339 (#4535)

This commit is contained in:
Surya Teja K 2023-03-19 13:24:45 +05:30 committed by GitHub
parent 60bf8e1f88
commit b39c4d2756
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -314,6 +314,7 @@ pub fn uu_app() -> Command {
Arg::new(OPT_RFC_3339)
.long(OPT_RFC_3339)
.value_name("FMT")
.value_parser([DATE, SECOND, SECONDS, NS])
.help(RFC_3339_HELP_STRING),
)
.arg(

View file

@ -43,6 +43,13 @@ fn test_date_rfc_3339() {
}
}
#[test]
fn test_date_rfc_3339_invalid_arg() {
for param in ["--iso-3339", "--rfc-3"] {
new_ucmd!().arg(format!("{param}=foo")).fails();
}
}
#[test]
fn test_date_rfc_8601_default() {
let re = Regex::new(r"^\d{4}-\d{2}-\d{2}\n$").unwrap();