From 973c603d7af0a0573a1fc43c430cd93f243a1eeb Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 5 Sep 2018 19:04:31 -0500 Subject: [PATCH] Add basic conversion test --- src/datetime.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/datetime.rs b/src/datetime.rs index 8b873c3..b8e0ee6 100644 --- a/src/datetime.rs +++ b/src/datetime.rs @@ -681,6 +681,14 @@ impl From> for SystemTime { } } +#[test] +fn test_auto_conversion() { + let utc_dt = Utc.ymd(2018, 9, 5).and_hms(23, 58, 0); + let cdt_dt = FixedOffset::west(5 * 60 * 60).ymd(2018, 9, 5).and_hms(18, 58, 0); + let utc_dt2: DateTime = cdt_dt.into(); + assert_eq!(utc_dt, utc_dt2); +} + #[cfg(all(test, any(feature = "rustc-serialize", feature = "serde")))] fn test_encodable_json(to_string_utc: FUtc, to_string_fixed: FFixed) where FUtc: Fn(&DateTime) -> Result,