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]

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]

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]

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]

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]

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]

Formats the value using the given formatter. Read more

impl<L> Not for Theory<L> where
    L: Debug
[src]

The resulting type after applying the ! operator.

Performs the unary ! operation.

Auto Trait Implementations

impl<L> Send for Theory<L> where
    L: Send

impl<L> Sync for Theory<L> where
    L: Sync