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

This commit is contained in:
Surya Teja K
2023-03-19 08:54:45 +01:00
committed by GitHub
parent 60bf8e1f88
commit b39c4d2756
2 changed files with 8 additions and 0 deletions
+1
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(
+7
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();