Skip to content

Commit

Permalink
Add test for issue 551
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker authored and djc committed Apr 18, 2023
1 parent 5bc022c commit 35eaac3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/format/parsed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1287,4 +1287,18 @@ mod tests {

// TODO test with a variable time zone (for None and Ambiguous cases)
}

#[test]
fn issue_551() {
use crate::Weekday;
let mut parsed = Parsed::new();

parsed.year = Some(2002);
parsed.week_from_mon = Some(22);
parsed.weekday = Some(Weekday::Mon);
assert_eq!(NaiveDate::from_ymd_opt(2002, 6, 3).unwrap(), parsed.to_naive_date().unwrap());

parsed.year = Some(2001);
assert_eq!(NaiveDate::from_ymd_opt(2001, 5, 28).unwrap(), parsed.to_naive_date().unwrap());
}
}

0 comments on commit 35eaac3

Please sign in to comment.