Skip to content

Commit

Permalink
Include Guayaquil from macOS 10.11 as test
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jul 25, 2023
1 parent f3b7b62 commit 2598125
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/offset/local/tz_info/timezone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,38 @@ mod tests {
Ok(())
}

#[test]
fn test_no_tz_string() -> Result<(), Error> {
// Guayaquil from macOS 10.11
let bytes = b"TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x02\0\0\0\x02\0\0\0\0\0\0\0\x01\0\0\0\x02\0\0\0\x08\xb6\xa4B\x18\x01\xff\xff\xb6h\0\0\xff\xff\xb9\xb0\0\x04QMT\0ECT\0\0\0\0\0";

let time_zone = TimeZone::from_tz_data(bytes)?;
dbg!(&time_zone);

let time_zone_result = TimeZone::new(
vec![Transition::new(-1230749160, 1)],
vec![
LocalTimeType::new(-18840, false, Some(b"QMT"))?,
LocalTimeType::new(-18000, false, Some(b"ECT"))?,
],
Vec::new(),
None,
)?;

assert_eq!(time_zone, time_zone_result);

assert_eq!(
*time_zone.find_local_time_type(-1500000000)?,
LocalTimeType::new(-18840, false, Some(b"QMT"))?
);
assert_eq!(
*time_zone.find_local_time_type(0)?,
LocalTimeType::new(-18000, false, Some(b"ECT"))?
);

Ok(())
}

#[test]
fn test_tz_ascii_str() -> Result<(), Error> {
assert!(matches!(TimeZoneName::new(b""), Err(Error::LocalTimeType(_))));
Expand Down

0 comments on commit 2598125

Please sign in to comment.