Skip to content

Commit

Permalink
Don't test the same thing twice in test_date_extreme_offset
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Aug 3, 2023
1 parent e39078c commit 2e2374f
Showing 1 changed file with 12 additions and 32 deletions.
44 changes: 12 additions & 32 deletions src/offset/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,45 +262,25 @@ mod tests {
fn test_date_extreme_offset() {
// starting from 0.3 we don't have an offset exceeding one day.
// this makes everything easier!
let offset = FixedOffset::east_opt(86399).unwrap();
assert_eq!(
format!(
"{:?}",
FixedOffset::east_opt(86399)
.unwrap()
.with_ymd_and_hms(2012, 2, 29, 5, 6, 7)
.unwrap()
),
"2012-02-29T05:06:07+23:59:59".to_string()
format!("{:?}", offset.with_ymd_and_hms(2012, 2, 29, 5, 6, 7).unwrap()),
"2012-02-29T05:06:07+23:59:59"
);
let offset = FixedOffset::east_opt(-86399).unwrap();
assert_eq!(
format!(
"{:?}",
FixedOffset::east_opt(86399)
.unwrap()
.with_ymd_and_hms(2012, 2, 29, 5, 6, 7)
.unwrap()
),
"2012-02-29T05:06:07+23:59:59".to_string()
format!("{:?}", offset.with_ymd_and_hms(2012, 2, 29, 5, 6, 7).unwrap()),
"2012-02-29T05:06:07-23:59:59"
);
let offset = FixedOffset::west_opt(86399).unwrap();
assert_eq!(
format!(
"{:?}",
FixedOffset::west_opt(86399)
.unwrap()
.with_ymd_and_hms(2012, 3, 4, 5, 6, 7)
.unwrap()
),
"2012-03-04T05:06:07-23:59:59".to_string()
format!("{:?}", offset.with_ymd_and_hms(2012, 3, 4, 5, 6, 7).unwrap()),
"2012-03-04T05:06:07-23:59:59"
);
let offset = FixedOffset::west_opt(-86399).unwrap();
assert_eq!(
format!(
"{:?}",
FixedOffset::west_opt(86399)
.unwrap()
.with_ymd_and_hms(2012, 3, 4, 5, 6, 7)
.unwrap()
),
"2012-03-04T05:06:07-23:59:59".to_string()
format!("{:?}", offset.with_ymd_and_hms(2012, 3, 4, 5, 6, 7).unwrap()),
"2012-03-04T05:06:07+23:59:59"
);
}

Expand Down

0 comments on commit 2e2374f

Please sign in to comment.