pub struct ExpectationList<'e, T>(/* private fields */);Expand description
List of expectations on a value.
Implementations§
Source§impl<'e, T: Debug> ExpectationList<'e, T>
impl<'e, T: Debug> ExpectationList<'e, T>
Sourcepub fn push(&mut self, expectation: impl Expectation<T> + 'e)
pub fn push(&mut self, expectation: impl Expectation<T> + 'e)
Add a new expectation to the list.
Sourcepub fn check(&self, value: &T) -> CheckResult
pub fn check(&self, value: &T) -> CheckResult
Check all expectations on the value.
Runs all expectations in order.
§Returns
CheckResult::Pass if all expectations pass, otherwise CheckResult::Fail with a formatted message.
If multiple failures occur, they are concatenated with newlines.
Trait Implementations§
Source§impl<'e, T: Debug> Default for ExpectationList<'e, T>
impl<'e, T: Debug> Default for ExpectationList<'e, T>
Source§impl<'e, T> ExpectationBuilder<'e> for ExpectationList<'e, T>where
T: Debug + 'e,
impl<'e, T> ExpectationBuilder<'e> for ExpectationList<'e, T>where
T: Debug + 'e,
Auto Trait Implementations§
impl<'e, T> Freeze for ExpectationList<'e, T>
impl<'e, T> !RefUnwindSafe for ExpectationList<'e, T>
impl<'e, T> !Send for ExpectationList<'e, T>
impl<'e, T> !Sync for ExpectationList<'e, T>
impl<'e, T> Unpin for ExpectationList<'e, T>
impl<'e, T> UnsafeUnpin for ExpectationList<'e, T>
impl<'e, T> !UnwindSafe for ExpectationList<'e, T>
Blanket Implementations§
Source§impl<'e, B> BooleanExpectations for B
impl<'e, B> BooleanExpectations for B
Source§fn to_be_true(self) -> B
fn to_be_true(self) -> B
Expect the value to be true Read more
Source§fn to_be_false(self) -> B
fn to_be_false(self) -> B
Expect the value to be false Read more
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<'e, T, U, B> EqualityExpectations<T, U> for B
impl<'e, T, U, B> EqualityExpectations<T, U> for B
Source§impl<'e, T, U, B> ExpectProjection<'e, T, U> for B
impl<'e, T, U, B> ExpectProjection<'e, T, U> for B
Source§fn projected_by<F>(
self,
projection: F,
) -> ProjectedExpectationsBuilder<'e, B, T, U>
fn projected_by<F>( self, projection: F, ) -> ProjectedExpectationsBuilder<'e, B, T, U>
Add expectations on a projected value. Read more
Source§fn projected_by_ref<F>(
self,
projection: F,
) -> ProjectedExpectationsBuilder<'e, B, T, U>
fn projected_by_ref<F>( self, projection: F, ) -> ProjectedExpectationsBuilder<'e, B, T, U>
Add expectations on a projected reference. Read more
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 moreSource§impl<'e, I, C, B> IterableCountExpectations<'e, B> for Bwhere
I: Debug + 'e,
&'a I: for<'a> IntoIterator<Item = &'a C>,
C: Debug,
B: ExpectationBuilder<'e, Value = I>,
impl<'e, I, C, B> IterableCountExpectations<'e, B> for Bwhere
I: Debug + 'e,
&'a I: for<'a> IntoIterator<Item = &'a C>,
C: Debug,
B: ExpectationBuilder<'e, Value = I>,
Source§fn count(self) -> impl ExpectationBuilder<'e, Value = usize>
fn count(self) -> impl ExpectationBuilder<'e, Value = usize>
Make expectations on the number of items in the iterable. Read more
Source§fn to_not_be_empty(self) -> B
fn to_not_be_empty(self) -> B
Expect an iterable to not be empty. Read more
Source§fn to_be_empty(self) -> B
fn to_be_empty(self) -> B
Expect an iterable to be empty. Read more
Source§impl<'e, I, C, B> IterableItemEqualityExpectations<'e, B, C> for Bwhere
I: Debug,
&'a I: for<'a> IntoIterator<Item = &'a C>,
C: PartialEq + Debug + 'e,
B: ExpectationBuilder<'e, Value = I>,
impl<'e, I, C, B> IterableItemEqualityExpectations<'e, B, C> for Bwhere
I: Debug,
&'a I: for<'a> IntoIterator<Item = &'a C>,
C: PartialEq + Debug + 'e,
B: ExpectationBuilder<'e, Value = I>,
Source§fn to_contain_equal_to(self, value: C) -> B
fn to_contain_equal_to(self, value: C) -> B
Expect an iterable to contain at least one value equal to another value Read more
Source§fn to_contain_equal_to_all_of(self, values: impl IntoIterator<Item = C>) -> B
fn to_contain_equal_to_all_of(self, values: impl IntoIterator<Item = C>) -> B
Expect an iterable to contain at least one value equal to another value Read more
Source§fn to_be_equivalent_to(self, values: impl IntoIterator<Item = C>) -> B
fn to_be_equivalent_to(self, values: impl IntoIterator<Item = C>) -> B
Expect an iterable to be equivalent to another iterable Read more
Source§fn to_be_equivalent_to_in_any_order(
self,
values: impl IntoIterator<Item = C>,
) -> B
fn to_be_equivalent_to_in_any_order( self, values: impl IntoIterator<Item = C>, ) -> B
Expect an iterable to be equivalent to another iterable, ignoring the order of items Read more
Source§impl<'e, T, B> OptionExpectations<'e, T> for B
impl<'e, T, B> OptionExpectations<'e, T> for B
Source§fn to_be_some(self) -> B
fn to_be_some(self) -> B
Expect the Option to be Some Read more
Source§fn to_be_none(self) -> B
fn to_be_none(self) -> B
Expect the Option to be None Read more
Source§impl<'e, T, B> OrderExpectations<'e, T> for B
impl<'e, T, B> OrderExpectations<'e, T> for B
Source§fn to_be_less_than(self, value: T) -> B
fn to_be_less_than(self, value: T) -> B
Expect the value to be less than another value Read more
Source§fn to_be_less_than_or_equal(self, value: T) -> B
fn to_be_less_than_or_equal(self, value: T) -> B
Expect the value to be less than or equal to another value Read more
Source§fn to_be_greater_than(self, value: T) -> B
fn to_be_greater_than(self, value: T) -> B
Expect the value to be greater than another value Read more
Source§fn to_be_greater_than_or_equal(self, value: T) -> B
fn to_be_greater_than_or_equal(self, value: T) -> B
Expect the value to be greater than or equal to another value Read more
Source§fn to_be_inside<R>(self, range: R) -> Bwhere
R: RangeBounds<T> + Debug + 'e,
fn to_be_inside<R>(self, range: R) -> Bwhere
R: RangeBounds<T> + Debug + 'e,
Expect the value to be inside a range Read more
Source§impl<'e, T, B> ProjectedOptionExpectations<'e, T> for B
impl<'e, T, B> ProjectedOptionExpectations<'e, T> for B
Source§fn to_be_some_and(self) -> ProjectedExpectationsBuilder<'e, B, Option<T>, T>
fn to_be_some_and(self) -> ProjectedExpectationsBuilder<'e, B, Option<T>, T>
Expect the Option to be Some and then chain into further expectations Read more
Source§impl<'e, T, E, B> ProjectedResultExpectations<'e, T, E> for B
impl<'e, T, E, B> ProjectedResultExpectations<'e, T, E> for B
Source§fn to_be_ok_and(self) -> ProjectedExpectationsBuilder<'e, B, Result<T, E>, T>
fn to_be_ok_and(self) -> ProjectedExpectationsBuilder<'e, B, Result<T, E>, T>
Expect the Result to be Ok and then chain into further expectations Read more
Source§fn to_be_err_and(self) -> ProjectedExpectationsBuilder<'e, B, Result<T, E>, E>
fn to_be_err_and(self) -> ProjectedExpectationsBuilder<'e, B, Result<T, E>, E>
Expect the Result to be Err and then chain into further expectations Read more
Source§impl<'e, T, E, B> ResultExpectations<'e, T, E> for B
impl<'e, T, E, B> ResultExpectations<'e, T, E> for B
Source§fn to_be_ok_matching<F>(self, predicate: F) -> B
fn to_be_ok_matching<F>(self, predicate: F) -> B
Expect the Result to be Ok and the Ok value to match a predicate Read more
Source§impl<'e, T, B> StringExpectations<'e, T> for B
impl<'e, T, B> StringExpectations<'e, T> for B
Source§fn to_contain(self, substring: &'e str) -> B
fn to_contain(self, substring: &'e str) -> B
Expect that a string contains a substring Read more
Source§fn to_not_contain(self, substring: &'e str) -> B
fn to_not_contain(self, substring: &'e str) -> B
Expect that a string does not contain a substring Read more
Source§fn to_have_length(self, length: usize) -> B
fn to_have_length(self, length: usize) -> B
Expect that a string has a specific length Read more
Source§fn to_start_with(self, prefix: &'e str) -> B
fn to_start_with(self, prefix: &'e str) -> B
Expect that a string starts with a specific prefix Read more
Source§fn to_end_with(self, suffix: &'e str) -> B
fn to_end_with(self, suffix: &'e str) -> B
Expect that a string ends with a specific suffix Read more
Source§fn to_be_empty(self) -> B
fn to_be_empty(self) -> B
Expect that a string is empty Read more
Source§fn to_be_all_whitespace(self) -> B
fn to_be_all_whitespace(self) -> B
Expect that a string consists entirely of whitespace characters Read more
Source§fn to_be_alphabetic(self) -> B
fn to_be_alphabetic(self) -> B
Expect that a string consists entirely of alphabetic characters Read more
Source§fn to_be_numeric(self) -> B
fn to_be_numeric(self) -> B
Expect that a string consists entirely of numeric characters Read more
Source§fn to_be_alphanumeric(self) -> B
fn to_be_alphanumeric(self) -> B
Expect that a string consists entirely of alphanumeric characters Read more