You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to reproduce: put this failing test case in the #[cfg(test)] module in lib.rs and then run cargo test test_parse_datetime_reference_date_and_time_delta:
#[test]
fn test_parse_datetime_reference_date_and_time_delta() {
// $ TZ=UTC0 date -I -d "1996-02-29 +1 year"
std::env::set_var("TZ", "UTC0");
let actual = parse_datetime("1996-02-29 +1 year").expect("parse failed");
// 1997-03-01
let expected = chrono::NaiveDate::from_ymd_opt(1997, 3, 1)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc();
assert_eq!(actual, expected);
}
What happens now: the test fails because parse_datetime() returns an error.
What I expected to happen: the test passes, with date "1996-02-29" parsed as the reference date, "+1 year" as the additional time delta to add, and the returned date being "1997-03-01" (with placeholder time of 00:00:00 in timezone UTC).
The text was updated successfully, but these errors were encountered:
Steps to reproduce: put this failing test case in the
#[cfg(test)]
module inlib.rs
and then runcargo test test_parse_datetime_reference_date_and_time_delta
:What happens now: the test fails because
parse_datetime()
returns an error.What I expected to happen: the test passes, with date "1996-02-29" parsed as the reference date, "+1 year" as the additional time delta to add, and the returned date being "1997-03-01" (with placeholder time of 00:00:00 in timezone UTC).
The text was updated successfully, but these errors were encountered: