Skip to content

Commit da8ea03

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 da8ea03

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/by-util/test_date.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,21 @@ fn test_invalid_date_string() {
420420
.stderr_contains("invalid date");
421421
}
422422

423+
#[test]
424+
fn test_date_set_check_valid_format() {
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)