Struct Suite

Source
pub struct Suite { /* private fields */ }
Expand description

§Represent a test suite

Implementations§

Source§

impl Suite

Source

pub fn new(before_each: fn(), after_each: fn()) -> Self

§Initialize the suite
  • before_each The callback to execute before each test
  • after_each The callback to execute after each test
Source

pub fn run(self, test: bool, success: &'static str, error: &'static str) -> Self

§Run a test
  • x The test
  • s The success message
  • e The error message
§Panics

if test fail

Source

pub fn end(&mut self) -> Result<()>

§End of the test suite
§Errors
Source

pub fn eq<X: PartialEq>(self, actual: &X, expected: &X) -> Self

§Check equality
  • actual The actual value
  • expected The expected value
Source

pub fn ok<X, Y>(self, a: &Result<X, Y>) -> Self

  • a The result to check if match Ok
Source

pub fn panic(self, c: impl FnOnce() + UnwindSafe) -> Self

§Check if a callback panic
  • c The callback to check
Source

pub fn not_panic(self, c: impl FnOnce() + UnwindSafe) -> Self

§Check if a callback don’t panic
  • c The callback to check
Source

pub fn ko<X, Y>(self, a: &Result<X, Y>) -> Self

  • a The data to check if X match Err
Source

pub fn len<X: ExactSizeIterator>(self, actual: &X, expected: &usize) -> Self

§Check the len
  • actual The actual len
  • expectedThe expected len
Source

pub fn ne<X: PartialEq>(self, actual: &X, expected: &X) -> Self

§Check inequality
  • actual The actual value
  • expected The expected value
Source

pub fn gt<X: PartialOrd>(self, actual: &X, expected: &X) -> Self

§Check if actual is greater than expected
  • actual The actual value
  • expected The expected value
Source

pub fn ge<X: PartialOrd>(self, actual: &X, expected: &X) -> Self

§Check if actual is greater or equal than expected
  • actual The actual value
  • expected The expected value
Source

pub fn str_contains(self, actual: &str, expected: &str) -> Self

§Check if actual is containing expected
  • actual The actual value
  • expected The expected value
Source

pub fn path_exists(self, actual: &str, expected: bool) -> Self

§Check if an actual path matches the expected value
  • actual The actual value
  • expected The expected value
Source

pub fn exists(self, actual: &str) -> Self

§Check if an actual path exists
  • actual The actual path
Source

pub fn str_not_contains(self, actual: &str, expected: &str) -> Self

§Check if actual is not containing expected
  • actual The actual value
  • expected The expected value
Source

pub fn le<X: PartialOrd>(self, actual: &X, expected: &X) -> Self

§Check if actual is lower or equal than expected
  • actual The actual value
  • expected The expected value
Source

pub fn lt<X: PartialOrd>(self, actual: &X, expected: &X) -> Self

§Check if actual is lower than expected
  • actual The actual value
  • expected The expected value
Source

pub fn response<X: PartialEq>( self, title: &str, description: &str, c: &dyn Fn(X) -> X, x: X, expected: &X, ) -> Self

§Check if the callback exit code match the expected exit code
  • actual The callback to check
  • expected The expected code
Source

pub fn theorem<X: PartialEq>( self, title: &str, description: &str, c: &dyn Fn() -> X, expected: &X, ) -> Self

§Check if a theorem is equal to expected value
  • c The theorem callback
  • expected The expected value
Source

pub fn theory<X: PartialEq>( self, title: &str, description: &str, callback: &X, expected: &X, ) -> Self

§Check if a theorem is equal to expected value
  • c The theorem callback
  • expected The expected value
Source

pub fn chaos<X: PartialEq>( self, title: &str, description: &str, c: &dyn Fn() -> X, expected: &X, ) -> Self

§Check if a theorem is different to expected
  • c The theorem callback
  • expected The expected value
Source

pub fn group( self, title: &str, description: &str, callback: fn(Self) -> Self, ) -> Self

§Check if actual is lower than expected
  • description The actual value
  • expected The expected value
Source

pub fn sure( self, title: &str, description: &str, callback: &dyn Fn(Self) -> Self, x: usize, ) -> Self

§Check if actual is lower than expected
  • description The actual value
  • expected The expected value

Trait Implementations§

Source§

impl Clone for Suite

Source§

fn clone(&self) -> Suite

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Suite

Auto Trait Implementations§

§

impl Freeze for Suite

§

impl RefUnwindSafe for Suite

§

impl Send for Suite

§

impl Sync for Suite

§

impl Unpin for Suite

§

impl UnwindSafe for Suite

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.