pub struct TestAssertions;
Expand description
Collection of test assertions
Implementations§
Source§impl TestAssertions
impl TestAssertions
Sourcepub fn assert_json_eq(
actual: &JsonValue,
expected: &JsonValue,
) -> TestResult<()>
pub fn assert_json_eq( actual: &JsonValue, expected: &JsonValue, ) -> TestResult<()>
Assert that two JSON values are equal
Sourcepub fn assert_json_contains(
actual: &JsonValue,
expected: &JsonValue,
) -> TestResult<()>
pub fn assert_json_contains( actual: &JsonValue, expected: &JsonValue, ) -> TestResult<()>
Assert that JSON contains expected fields/values
Sourcepub fn assert_in_range<T>(value: T, min: T, max: T) -> TestResult<()>where
T: PartialOrd + Display,
pub fn assert_in_range<T>(value: T, min: T, max: T) -> TestResult<()>where
T: PartialOrd + Display,
Assert that a value is within a certain range
Sourcepub fn assert_matches_pattern(text: &str, pattern: &str) -> TestResult<()>
pub fn assert_matches_pattern(text: &str, pattern: &str) -> TestResult<()>
Assert that a string matches a pattern
Sourcepub fn assert_contains<T, I>(collection: &[T], item: &I) -> TestResult<()>
pub fn assert_contains<T, I>(collection: &[T], item: &I) -> TestResult<()>
Assert that a collection contains an item
Sourcepub fn assert_length<T>(
collection: &[T],
expected_length: usize,
) -> TestResult<()>where
T: Debug,
pub fn assert_length<T>(
collection: &[T],
expected_length: usize,
) -> TestResult<()>where
T: Debug,
Assert that a collection has a specific length
Sourcepub fn assert_empty<T>(collection: &[T]) -> TestResult<()>where
T: Debug,
pub fn assert_empty<T>(collection: &[T]) -> TestResult<()>where
T: Debug,
Assert that a collection is empty
Sourcepub fn assert_not_empty<T>(collection: &[T]) -> TestResult<()>where
T: Debug,
pub fn assert_not_empty<T>(collection: &[T]) -> TestResult<()>where
T: Debug,
Assert that a collection is not empty
Sourcepub fn assert_all<T, F>(
collection: &[T],
predicate: F,
message: &str,
) -> TestResult<()>
pub fn assert_all<T, F>( collection: &[T], predicate: F, message: &str, ) -> TestResult<()>
Assert that all items in a collection satisfy a predicate
Sourcepub fn assert_any<T, F>(
collection: &[T],
predicate: F,
message: &str,
) -> TestResult<()>
pub fn assert_any<T, F>( collection: &[T], predicate: F, message: &str, ) -> TestResult<()>
Assert that any item in a collection satisfies a predicate
Sourcepub fn assert_time_close(
actual: DateTime<Utc>,
expected: DateTime<Utc>,
tolerance_seconds: i64,
) -> TestResult<()>
pub fn assert_time_close( actual: DateTime<Utc>, expected: DateTime<Utc>, tolerance_seconds: i64, ) -> TestResult<()>
Assert that two time values are close (within tolerance)
Auto Trait Implementations§
impl Freeze for TestAssertions
impl RefUnwindSafe for TestAssertions
impl Send for TestAssertions
impl Sync for TestAssertions
impl Unpin for TestAssertions
impl UnwindSafe for TestAssertions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more