Skip to content

Commit

Permalink
Add test for deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jul 24, 2023
1 parent e970169 commit ac1b5d3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/datetime/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1481,3 +1481,16 @@ fn test_auto_conversion() {
let utc_dt2: DateTime<Utc> = cdt_dt.into();
assert_eq!(utc_dt, utc_dt2);
}

#[test]
#[cfg(feature = "clock")]
#[allow(deprecated)]
fn test_test_deprecated_from_offset() {
let now = Local::now();
let naive = now.naive_local();
let utc = now.naive_utc();
let offset: FixedOffset = *now.offset();

assert_eq!(DateTime::<Local>::from_local(naive, offset), now);
assert_eq!(DateTime::<Local>::from_utc(utc, offset), now);
}

0 comments on commit ac1b5d3

Please sign in to comment.