mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
date: fix invalid argument error for RFC 3339 (#4535)
This commit is contained in:
parent
60bf8e1f88
commit
b39c4d2756
2 changed files with 8 additions and 0 deletions
|
@ -314,6 +314,7 @@ pub fn uu_app() -> Command {
|
||||||
Arg::new(OPT_RFC_3339)
|
Arg::new(OPT_RFC_3339)
|
||||||
.long(OPT_RFC_3339)
|
.long(OPT_RFC_3339)
|
||||||
.value_name("FMT")
|
.value_name("FMT")
|
||||||
|
.value_parser([DATE, SECOND, SECONDS, NS])
|
||||||
.help(RFC_3339_HELP_STRING),
|
.help(RFC_3339_HELP_STRING),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
|
|
@ -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]
|
#[test]
|
||||||
fn test_date_rfc_8601_default() {
|
fn test_date_rfc_8601_default() {
|
||||||
let re = Regex::new(r"^\d{4}-\d{2}-\d{2}\n$").unwrap();
|
let re = Regex::new(r"^\d{4}-\d{2}-\d{2}\n$").unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue