Skip to content

Commit b17129d

Browse files
committed
date: add ignored tests that passes with GNU and fails with Rust
1 parent df23bda commit b17129d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/by-util/test_date.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,3 +944,41 @@ fn test_date_tz_abbreviation_unknown() {
944944
.fails()
945945
.stderr_contains("invalid date");
946946
}
947+
948+
#[test]
949+
#[ignore = "we reject 'J', GNU treats as midnight"]
950+
fn test_date_fuzz_military_timezone_j() {
951+
// J is reserved for local time in military timezones
952+
// GNU date treats it as midnight, we reject it
953+
new_ucmd!()
954+
.env("TZ", "UTC+1")
955+
.arg("-d")
956+
.arg("J")
957+
.arg("+%F %T %Z")
958+
.succeeds()
959+
.stdout_contains("00:00:00");
960+
}
961+
962+
#[test]
963+
#[ignore = "we use current time, GNU uses midnight"]
964+
fn test_date_fuzz_empty_string() {
965+
// Empty string should be treated as midnight today
966+
new_ucmd!()
967+
.env("TZ", "UTC+1")
968+
.arg("-d")
969+
.arg("")
970+
.succeeds()
971+
.stdout_contains("00:00:00");
972+
}
973+
974+
#[test]
975+
#[ignore = "we produce year 0008, GNU gives today 12:00"]
976+
fn test_date_fuzz_relative_m9() {
977+
// Relative date string "m9" should be parsed correctly
978+
new_ucmd!()
979+
.env("TZ", "UTC+9")
980+
.arg("-d")
981+
.arg("m9")
982+
.succeeds()
983+
.stdout_contains("12:00:00");
984+
}

0 commit comments

Comments
 (0)