actual_with

Function actual_with 

Source
pub fn actual_with<T>(val: T, description_func: fn(&T) -> String) -> Actual<T>
Expand description

Creates a new Actual wrapper. You should provide your own function to represent value as String. Can be used if you need custom description or value doesn’t implement Display trait

§Examples

Basic usage:

use easy_assert::{actual_with};

fn my_description(value: &i32) -> String {
    format!("My own description for value {}", value)
}

let actual = actual_with(1, my_description);

Test usage:

use easy_assert::{actual_with, expected_with};
use easy_assert::num_assertions::NumericAssert;

fn my_description(value: &i32) -> String {
    format!("My own description for value {}", value)
}

NumericAssert::assert_that(actual_with(1, my_description))
.is_equal().to(expected_with(1, my_description));