Struct fluid::Theory [−][src]
#[must_use]pub struct Theory<L> where
L: Debug, { /* fields omitted */ }
Main data structure used to create assertions: see its methods.
Methods
impl<L> Theory<L> where
L: Debug,
[src]
impl<L> Theory<L> where
L: Debug,
pub fn be_equal_to<R>(self, right: R) -> BeEqualTo<L, R> where
L: PartialEq<R> + Debug,
R: Debug,
[src]
pub fn be_equal_to<R>(self, right: R) -> BeEqualTo<L, R> where
L: PartialEq<R> + Debug,
R: Debug,
Checks if the left field is equal to the right field.
Example
use fluid::*; theory!(1 + 1).should().be_equal_to(2);
impl<L> Theory<L> where
L: IntoIterator + Debug,
L::IntoIter: Debug,
[src]
impl<L> Theory<L> where
L: IntoIterator + Debug,
L::IntoIter: Debug,
pub fn be_empty(self) -> BeEmpty<L::IntoIter>
[src]
pub fn be_empty(self) -> BeEmpty<L::IntoIter>
Checks if the left field is an iterator that is empty.
Example
use fluid::*; theory!(Some(2)).should().not().be_empty(); let empty_array = [0; 0]; theory!(&empty_array).should().be_empty();
impl<L> Theory<L> where
L: IntoIterator + Debug,
L::IntoIter: Debug,
[src]
impl<L> Theory<L> where
L: IntoIterator + Debug,
L::IntoIter: Debug,
pub fn contain<R>(self, right: R) -> Contain<L::IntoIter, R> where
L::Item: PartialEq<R> + Debug,
R: Debug,
[src]
pub fn contain<R>(self, right: R) -> Contain<L::IntoIter, R> where
L::Item: PartialEq<R> + Debug,
R: Debug,
Checks if the left field is an iterator that contains the right field.
Example
use fluid::*; theory!(Some(2)).should().contain(2); theory!(&[1, 2, 3]).should().contain(&2);
impl<O, E> Theory<Result<O, E>> where
E: Debug,
O: Debug,
[src]
impl<O, E> Theory<Result<O, E>> where
E: Debug,
O: Debug,
pub fn be_an_error(self) -> BeAnError<O, E>
[src]
pub fn be_an_error(self) -> BeAnError<O, E>
Check if the left field is the Err
variant of the Result
.
Example
use fluid::*; let result = "two".parse::<i32>(); theory!(result).should().be_an_error() .because("“two“ is not a valid number");
impl<O, E> Theory<Result<O, E>> where
E: Debug + PartialEq<E>,
O: Debug,
[src]
impl<O, E> Theory<Result<O, E>> where
E: Debug + PartialEq<E>,
O: Debug,
pub fn be_this_error(self, right: E) -> BeThisError<O, E>
[src]
pub fn be_this_error(self, right: E) -> BeThisError<O, E>
Checks if the left field is a result that is an error equal to the right field.
Example
use fluid::*; let parse_error = match "?".parse::<i32>() { Ok(_) => unimplemented!(), Err(e) => e, }; let result = "two".parse::<i32>(); theory!(result).should().be_this_error(parse_error);
Trait Implementations
impl<L: Debug> Debug for Theory<L> where
L: Debug,
[src]
impl<L: Debug> Debug for Theory<L> where
L: Debug,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<L> Not for Theory<L> where
L: Debug,
[src]
impl<L> Not for Theory<L> where
L: Debug,