From e4f89761a7c3578211110bc4e14403bcac3e4720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorian=20P=C3=A9ron?= Date: Sat, 15 Jun 2024 13:18:18 +0200 Subject: [PATCH] tests(date): Add tests for #6392 These tests check that days and month with a single digit are correctly handled. --- tests/by-util/test_date.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index bf9e1d86c..553414af8 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -420,6 +420,21 @@ fn test_invalid_date_string() { .stderr_contains("invalid date"); } +#[test] +fn test_date_one_digit_date() { + new_ucmd!() + .arg("-d") + .arg("2000-1-1") + .succeeds() + .stdout_contains("Sat Jan 1 00:00:00 2000"); + + new_ucmd!() + .arg("-d") + .arg("2000-1-4") + .succeeds() + .stdout_contains("Tue Jan 4 00:00:00 2000"); +} + #[test] fn test_date_overflow() { new_ucmd!()