[−][src]Struct fluid::core::should::Should
Main data structure used to create assertions. See its methods for more information about the existing assertions.
Methods
impl<L: Debug> Should<L>
[src]
pub fn be_equal_to<R: Debug>(self, right: R) -> ChainableAssert<BeEqualTo<L, R>> where
L: PartialEq<R>,
[src]
L: PartialEq<R>,
Checks if the left field is equal to the right field.
Example
fn the_answer() -> i32 { 42 } the_answer().should().be_equal_to(42);
impl Should<bool>
[src]
pub fn be_true(self) -> ChainableAssert<Boolean>
[src]
pub fn be_false(self) -> ChainableAssert<Boolean>
[src]
impl<L: Debug> Should<L>
[src]
pub fn have_the_property<F>(
self,
closure: F
) -> ChainableAssert<HaveProperty<L, F>> where
F: FnOnce(&L) -> bool,
[src]
self,
closure: F
) -> ChainableAssert<HaveProperty<L, F>> where
F: FnOnce(&L) -> bool,
Checks if a user-defined property is satisfied.
Example
fn an_even_number() -> i32 { 2 } an_even_number().should().have_the_property(|&n| n % 2 == 0);
impl<I: Debug> Should<I> where
I: IntoIterator,
I::Item: PartialEq<I::Item> + Debug,
I::IntoIter: Debug,
[src]
I: IntoIterator,
I::Item: PartialEq<I::Item> + Debug,
I::IntoIter: Debug,
pub fn yield_the_item(
self,
right: I::Item
) -> ConsumingAssert<ContainIterator<I::IntoIter>>
[src]
self,
right: I::Item
) -> ConsumingAssert<ContainIterator<I::IntoIter>>
Checks if an iterator contains the right field.
Example
let it = vec![1, 2, 3, 4].into_iter(); it.should().not().yield_the_item(0);
impl<O: Debug, E: Debug> Should<Result<O, E>>
[src]
pub fn be_an_error(self) -> ChainableAssert<BeAnError<O, E>>
[src]
Checks if a result is an error.
Example
let result = "two".parse::<i32>(); result.should().be_an_error().because("“two“ is not a valid number");
impl<O: Debug, E: Debug> Should<Result<O, E>>
[src]
pub fn be_ok(self) -> ChainableAssert<BeOk<O, E>>
[src]
Trait Implementations
impl<C: Debug> ShouldCollection<C> for Should<C> where
C: Collection,
[src]
C: Collection,
fn contain<P>(self, right: P) -> ChainableAssert<ContainCollection<C, P>> where
P: CollectionPattern<C>,
[src]
P: CollectionPattern<C>,
fn be_empty(self) -> ChainableAssert<BeEmptyCollection<C>>
[src]
impl<S: Debug> ShouldString<S> for Should<S> where
S: AsRef<str>,
[src]
S: AsRef<str>,
fn contain<P>(self, right: P) -> ChainableAssert<ContainString<S, P>> where
P: StringPattern,
[src]
P: StringPattern,
fn start_with<P>(self, right: P) -> ChainableAssert<StartWithString<S, P>> where
P: StringPattern,
[src]
P: StringPattern,
fn end_with<P>(self, right: P) -> ChainableAssert<EndWithString<S, P>> where
P: StringPattern,
[src]
P: StringPattern,
fn be_empty(self) -> ChainableAssert<BeEmptyString<S>>
[src]
impl<L> Default for Should<L> where
L: Debug,
[src]
L: Debug,
impl<L> From<ShouldImpl<L>> for Should<L> where
L: Debug,
[src]
L: Debug,
fn from(implem: ShouldImpl<L>) -> Self
[src]
impl<L> From<Should<L>> for ShouldImpl<L> where
L: Debug,
[src]
L: Debug,
impl<'a, L> From<&'a mut Should<L>> for &'a mut ShouldImpl<L> where
L: Debug,
[src]
L: Debug,
impl<L: Debug> Debug for Should<L> where
L: Debug,
[src]
L: Debug,
impl<L> Not for Should<L> where
L: Debug,
[src]
L: Debug,
Auto Trait Implementations
Blanket Implementations
impl<L> ShouldExtension for L where
L: Debug,
[src]
L: Debug,
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,