Skip to content

Commit 1018c74

Browse files
committed
tests(date): Add tests for #6392
These tests check that days and month with a single digit are correctly handled.
1 parent 256b2de commit 1018c74

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/by-util/test_date.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is part of the uutils coreutils package.
1+
/ This file is part of the uutils coreutils package.
22
//
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
@@ -420,6 +420,21 @@ fn test_invalid_date_string() {
420420
.stderr_contains("invalid date");
421421
}
422422

423+
#[test]
424+
fn test_date_one_digit_date() {
425+
new_ucmd!()
426+
.arg("-d")
427+
.arg("2000-1-1")
428+
.succeeds()
429+
.stdout_contains("Sat Jan 1 00:00:00 2000");
430+
431+
new_ucmd!()
432+
.arg("-d")
433+
.arg("2000-1-4")
434+
.succeeds()
435+
.stdout_contains("Tue Jan 4 00:00:00 2000");
436+
}
437+
423438
#[test]
424439
fn test_date_overflow() {
425440
new_ucmd!()

0 commit comments

Comments
 (0)