1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

date: fix format for nanoseconds

This commit is contained in:
Jan Scheer 2021-05-11 23:03:59 +02:00
parent 019f1b1a88
commit 8200d399e8
2 changed files with 26 additions and 4 deletions

View file

@ -104,6 +104,23 @@ fn test_date_format_full_day() {
.stdout_matches(&re);
}
#[test]
fn test_date_nano_seconds() {
// %N nanoseconds (000000000..999999999)
let re = Regex::new(r"^\d{1,9}$").unwrap();
new_ucmd!().arg("+%N").succeeds().stdout_matches(&re);
}
#[test]
fn test_date_format_without_plus() {
// [+FORMAT]
new_ucmd!()
.arg("%s")
.fails()
.stderr_contains("date: invalid date %s")
.code_is(1);
}
#[test]
#[cfg(all(unix, not(target_os = "macos")))]
fn test_date_set_valid() {