Skip to content

Commit 5a8a3df

Browse files
committed
date: add test for cross-TZ-mishandled GNU test
Test parsing dates with embedded timezone specifications.
1 parent aaf0c45 commit 5a8a3df

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
@@ -2156,3 +2156,18 @@ fn test_date_rel2b_month_arithmetic() {
21562156
.succeeds()
21572157
.stdout_is("1996-03-02\n");
21582158
}
2159+
2160+
// Tests for GNU test cross-TZ-mishandled: embedded timezone parsing
2161+
#[test]
2162+
fn test_date_cross_tz_mishandled() {
2163+
// GNU test cross-TZ-mishandled: Parse date with embedded timezone
2164+
// Date should be interpreted in embedded TZ, then displayed in environment TZ
2165+
new_ucmd!()
2166+
.env("TZ", "PST8")
2167+
.env("LC_ALL", "C")
2168+
.args(&["-d", r#"TZ="EST5" 1970-01-01 00:00"#])
2169+
.succeeds()
2170+
.stdout_contains("Dec 31")
2171+
.stdout_contains("21:00:00")
2172+
.stdout_contains("1969");
2173+
}

0 commit comments

Comments
 (0)