diff --git a/Cargo.toml b/Cargo.toml index 45f8209..d9f87ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,7 +55,7 @@ bigdecimal = { version = "0.4", optional = true, default-features = false } chrono = { version = "0.4", optional = true, default-features = false, features = ["alloc"] } float-cmp = { version = "0.10", optional = true } indexmap = { version = "2", optional = true, default-features = false } -jiff = { version = "0.2", optional = true, default-features = false, features = ["alloc"] } +jiff = { version = "1", optional = true, default-features = false, features = ["alloc"] } num-bigint = { version = "0.5", optional = true, default-features = false } once_cell = { version = "1", optional = true, default-features = false, features = ["alloc", "critical-section"] } rapidhash = { version = "4", optional = true, default-features = false } @@ -68,7 +68,7 @@ time = { version = "0.3", optional = true, default-features = false, features = [dev-dependencies] anyhow = "1" fakeenv = { version = "0.1", default-features = false, features = ["fake"] } -jiff = { version = "0.2", default-features = true } +jiff = { version = "1", default-features = true } proptest = "1" serde = { version = "1", default-features = false, features = ["alloc", "derive"] } serde_bytes = { version = "0.11", default-features = false, features = ["alloc"] } diff --git a/src/jiff/mod.rs b/src/jiff/mod.rs index 7843033..edc7337 100644 --- a/src/jiff/mod.rs +++ b/src/jiff/mod.rs @@ -8,7 +8,7 @@ use crate::spec::{ }; use crate::temporal::{TemporalMargin, ToDuration}; use jiff::civil::{Date, DateTime, Time}; -use jiff::{SignedDuration, Span, Timestamp, Zoned}; +use jiff::{SignedDuration, Span, Timestamp, ZonedDateTime}; #[cfg(test)] mod tests; @@ -265,29 +265,34 @@ where impl Invertible for IsCloseTo {} -impl AssertIsCloseToWithinMargin for Spec<'_, Zoned, D, R> +impl AssertIsCloseToWithinMargin + for Spec<'_, ZonedDateTime, D, R> where - D: Represent + Represent, + D: Represent + Represent, R: FailingStrategy, { - fn is_close_to_with_margin(self, expected: Zoned, margin: impl Into) -> Self { + fn is_close_to_with_margin( + self, + expected: ZonedDateTime, + margin: impl Into, + ) -> Self { self.expecting(is_close_to(expected).within_margin(margin)) } fn is_not_close_to_with_margin( self, - expected: Zoned, + expected: ZonedDateTime, margin: impl Into, ) -> Self { self.expecting(not(is_close_to(expected).within_margin(margin))) } } -impl Expectation for IsCloseTo +impl Expectation for IsCloseTo where - D: Represent + Represent, + D: Represent + Represent, { - fn test(&mut self, subject: &Zoned) -> bool { + fn test(&mut self, subject: &ZonedDateTime) -> bool { if *subject < self.expected { subject.duration_until(&self.expected) <= self.margin.to_duration() } else { @@ -298,7 +303,7 @@ where fn message( &self, expression: &Expression<'_>, - actual: &Zoned, + actual: &ZonedDateTime, inverted: bool, representation: &D, format: &DiffFormat, @@ -316,7 +321,7 @@ where } } -impl Invertible for IsCloseTo {} +impl Invertible for IsCloseTo {} impl AssertIsCloseToWithinMargin for DerivedSpec<'_, O, Timestamp, D> @@ -399,18 +404,23 @@ where } } -impl AssertIsCloseToWithinMargin for DerivedSpec<'_, O, Zoned, D> +impl AssertIsCloseToWithinMargin + for DerivedSpec<'_, O, ZonedDateTime, D> where - D: Represent + Represent, + D: Represent + Represent, O: DoFail, { - fn is_close_to_with_margin(self, expected: Zoned, margin: impl Into) -> Self { + fn is_close_to_with_margin( + self, + expected: ZonedDateTime, + margin: impl Into, + ) -> Self { self.expecting(is_close_to(expected).within_margin(margin)) } fn is_not_close_to_with_margin( self, - expected: Zoned, + expected: ZonedDateTime, margin: impl Into, ) -> Self { self.expecting(not(is_close_to(expected).within_margin(margin))) diff --git a/src/jiff/tests.rs b/src/jiff/tests.rs index a999699..8dc1c27 100644 --- a/src/jiff/tests.rs +++ b/src/jiff/tests.rs @@ -3,7 +3,7 @@ use crate::prelude::*; use crate::temporal::TemporalMargin; use jiff::civil::{Date, DateTime, Time, date, datetime, time}; -use jiff::{SignedDuration, Span, Timestamp, Zoned}; +use jiff::{SignedDuration, Span, Timestamp, ZonedDateTime}; #[test] fn temporal_margin_of_nanoseconds_to_duration() { @@ -477,7 +477,7 @@ fn verify_civil_datetime_is_close_to_within_milliseconds_plus_margin_fails() { } #[test] -fn zoned_is_equal_to() { +fn zoneddatetime_is_equal_to() { let subject = date(2022, 1, 1) .at(12, 34, 56, 0) .in_tz("UTC") @@ -492,7 +492,7 @@ fn zoned_is_equal_to() { } #[test] -fn zoned_is_before() { +fn zoneddatetime_is_before() { let subject = date(2022, 1, 1) .at(12, 34, 56, 0) .in_tz("UTC") @@ -507,7 +507,7 @@ fn zoned_is_before() { } #[test] -fn zoned_is_after() { +fn zoneddatetime_is_after() { let subject = date(2022, 1, 1) .at(12, 34, 56, 0) .in_tz("UTC") @@ -522,7 +522,7 @@ fn zoned_is_after() { } #[test] -fn zoned_is_between() { +fn zoneddatetime_is_between() { let subject = date(2022, 1, 1) .at(12, 34, 56, 0) .in_tz("UTC") @@ -541,7 +541,7 @@ fn zoned_is_between() { } #[test] -fn zoned_is_close_to_within_milliseconds_exact_equal() { +fn zoneddatetime_is_close_to_within_milliseconds_exact_equal() { let subject = date(2022, 1, 1) .at(12, 34, 56, 0) .in_tz("UTC") @@ -557,7 +557,7 @@ fn zoned_is_close_to_within_milliseconds_exact_equal() { } #[test] -fn zoned_is_close_to_within_milliseconds_plus_margin() { +fn zoneddatetime_is_close_to_within_milliseconds_plus_margin() { let subject = date(2022, 1, 1) .at(12, 34, 56, 0) .in_tz("UTC") @@ -574,7 +574,7 @@ fn zoned_is_close_to_within_milliseconds_plus_margin() { } #[test] -fn zoned_is_close_to_within_milliseconds_minus_margin() { +fn zoneddatetime_is_close_to_within_milliseconds_minus_margin() { let subject = date(2022, 1, 1) .at(12, 34, 56, 0) .in_tz("UTC") @@ -591,7 +591,7 @@ fn zoned_is_close_to_within_milliseconds_minus_margin() { } #[test] -fn verify_zoned_is_close_to_within_seconds_minus_margin_fails() { +fn verify_zoneddatetime_is_close_to_within_seconds_minus_margin_fails() { let subject = date(2022, 1, 1) .at(12, 34, 53, 0) .in_tz("UTC") @@ -620,7 +620,7 @@ fn verify_zoned_is_close_to_within_seconds_minus_margin_fails() { } #[test] -fn verify_zoned_is_close_to_within_seconds_plus_margin_fails() { +fn verify_zoneddatetime_is_close_to_within_seconds_plus_margin_fails() { let subject = date(2022, 1, 1) .at(12, 35, 0, 0) .in_tz("UTC") @@ -648,7 +648,7 @@ fn verify_zoned_is_close_to_within_seconds_plus_margin_fails() { } #[test] -fn zoned_is_close_to_within_minutes_different_utc_offset() { +fn zoneddatetime_is_close_to_within_minutes_different_utc_offset() { let subject = date(2022, 1, 1) .at(12, 34, 56, 0) .in_tz("Europe/Vienna") @@ -664,7 +664,7 @@ fn zoned_is_close_to_within_minutes_different_utc_offset() { } #[test] -fn verify_zoned_is_close_to_within_minutes_different_utc_offset_fails() { +fn verify_zoneddatetime_is_close_to_within_minutes_different_utc_offset_fails() { let subject = date(2022, 1, 1) .at(12, 34, 56, 0) .in_tz("Europe/Vienna") @@ -740,8 +740,8 @@ fn extracting_ref_civil_datetime_is_close_to_within_milliseconds() { } #[test] -fn extracting_ref_zoned_utc_is_close_to_within_minutes() { - struct MyZoned(Zoned); +fn extracting_ref_zoneddatetime_utc_is_close_to_within_minutes() { + struct MyZoned(ZonedDateTime); let subject = MyZoned( date(2023, 11, 30) @@ -762,8 +762,8 @@ fn extracting_ref_zoned_utc_is_close_to_within_minutes() { } #[test] -fn extracting_ref_zoned_tz_is_close_to_within_minutes() { - struct MyZoned(Zoned); +fn extracting_ref_zoneddatetime_tz_is_close_to_within_minutes() { + struct MyZoned(ZonedDateTime); let subject = MyZoned( date(2023, 11, 30)