pub struct Assertion<T> {
pub value: T,
pub expr_str: &'static str,
pub negated: bool,
pub steps: Vec<AssertionStep>,
pub in_chain: bool,
pub is_final: bool,
}Expand description
Represents the complete assertion with all steps
Fields§
§value: TThe value being tested
expr_str: &'static strThe expression string (variable name)
negated: boolWhether the current assertion is negated
steps: Vec<AssertionStep>All steps in the assertion chain
in_chain: boolFlag to track if this is part of a chain
is_final: boolFlag to mark the final step in a chain
Implementations§
Source§impl<T> Assertion<T>
impl<T> Assertion<T>
Sourcepub fn add_step(&self, sentence: AssertionSentence, result: bool) -> Selfwhere
T: Clone,
pub fn add_step(&self, sentence: AssertionSentence, result: bool) -> Selfwhere
T: Clone,
Add an assertion step and get back a cloned Assertion for chaining
Sourcepub fn set_last_logic(&mut self, op: LogicalOp)
pub fn set_last_logic(&mut self, op: LogicalOp)
Set the logical operation for the last step
Sourcepub fn mark_as_intermediate(&mut self)
pub fn mark_as_intermediate(&mut self)
Mark this assertion as non-final (intermediate step in a chain)
Sourcepub fn mark_as_final(&mut self)
pub fn mark_as_final(&mut self)
Mark this assertion as final (last step in a chain)
Sourcepub fn calculate_chain_result(&self) -> bool
pub fn calculate_chain_result(&self) -> bool
Calculate if the entire chain passes
Trait Implementations§
Source§impl<T: Clone> AndModifier<T> for Assertion<T>
impl<T: Clone> AndModifier<T> for Assertion<T>
Source§impl<V> BooleanMatchers for Assertion<V>
impl<V> BooleanMatchers for Assertion<V>
fn to_be_true(self) -> Self
fn to_be_false(self) -> Self
Source§impl<T, V> CollectionMatchers<T> for Assertion<V>
impl<T, V> CollectionMatchers<T> for Assertion<V>
fn to_be_empty(self) -> Self
fn to_have_length(self, expected: usize) -> Self
fn to_contain<U: PartialEq<T> + Debug>(self, expected: U) -> Self
fn to_contain_all_of<U: PartialEq<T> + Debug>(self, expected: &[U]) -> Self
fn to_equal_collection<U: PartialEq<T> + Debug>(self, expected: &[U]) -> Self
Source§impl<V, T> EqualityMatchers<T> for Assertion<V>
impl<V, T> EqualityMatchers<T> for Assertion<V>
Source§impl<M, K, V> HashMapMatchers<K, V> for Assertion<M>
impl<M, K, V> HashMapMatchers<K, V> for Assertion<M>
fn to_be_empty(self) -> Self
fn to_have_length(self, expected: usize) -> Self
fn to_contain_key<Q>(self, key: &Q) -> Self
fn to_contain_entry<Q, R>(self, key: &Q, value: &R) -> Self
Source§impl<T: Clone> NotModifier<T> for Assertion<T>
impl<T: Clone> NotModifier<T> for Assertion<T>
Source§impl<V> NumericMatchers<i32> for Assertion<V>
impl<V> NumericMatchers<i32> for Assertion<V>
fn to_be_positive(self) -> Self
fn to_be_negative(self) -> Self
fn to_be_zero(self) -> Self
fn to_be_greater_than(self, expected: i32) -> Self
fn to_be_greater_than_or_equal(self, expected: i32) -> Self
fn to_be_less_than(self, expected: i32) -> Self
fn to_be_less_than_or_equal(self, expected: i32) -> Self
fn to_be_in_range(self, range: Range<i32>) -> Self
fn to_be_even(self) -> Self
fn to_be_odd(self) -> Self
Source§impl<T, V> OptionMatchers<T> for Assertion<V>
impl<T, V> OptionMatchers<T> for Assertion<V>
fn to_be_some(self) -> Self
fn to_be_none(self) -> Self
fn to_contain(self, expected: &T) -> Selfwhere
T: PartialEq,
Source§impl<T: Clone> OrModifier<T> for Assertion<T>
impl<T: Clone> OrModifier<T> for Assertion<T>
Source§impl<V, T, E> ResultMatchers<T, E> for Assertion<V>
impl<V, T, E> ResultMatchers<T, E> for Assertion<V>
Source§impl<V> StringMatchers for Assertion<V>
impl<V> StringMatchers for Assertion<V>
fn to_be_empty(self) -> Self
fn to_have_length(self, expected: usize) -> Self
Source§fn to_contain(self, substring: &str) -> Self
fn to_contain(self, substring: &str) -> Self
Check if the string contains a substring
Source§fn to_contain_substring(self, substring: &str) -> Self
fn to_contain_substring(self, substring: &str) -> Self
Type-specific version of to_contain to avoid trait conflicts
fn to_start_with(self, prefix: &str) -> Self
fn to_end_with(self, suffix: &str) -> Self
fn to_match(self, pattern: &str) -> Self
Auto Trait Implementations§
impl<T> Freeze for Assertion<T>where
T: Freeze,
impl<T> RefUnwindSafe for Assertion<T>where
T: RefUnwindSafe,
impl<T> Send for Assertion<T>where
T: Send,
impl<T> Sync for Assertion<T>where
T: Sync,
impl<T> Unpin for Assertion<T>where
T: Unpin,
impl<T> UnwindSafe for Assertion<T>where
T: UnwindSafe,
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