Trait unit_testing::unit::object::Testable
source · pub trait Testable {
Show 25 methods
// Required methods
fn new(sleep_time: u64) -> Self;
fn matches(&mut self, pattern: &str, values: Vec<String>) -> &mut Self;
fn capture(
&mut self,
pattern: &str,
x: &str,
key: usize,
values: Vec<String>
) -> &mut Self;
fn it(
describe: &str,
sleep_time: u64,
callbacks: Vec<&dyn Fn(&mut Self) -> &mut Self>
);
fn ok(&mut self, f: &dyn Fn() -> bool) -> &mut Self;
fn ko(&mut self, f: &dyn Fn() -> bool) -> &mut Self;
fn assert(&mut self, test: bool) -> bool;
fn equals<T: PartialEq>(&mut self, a: T, b: T) -> &mut Self;
fn unequals<T: PartialEq>(&mut self, a: T, b: T) -> &mut Self;
fn superior<T: PartialOrd>(&mut self, a: T, min: T) -> &mut Self;
fn inferior<T: PartialOrd>(&mut self, a: T, max: T) -> &mut Self;
fn between<T: PartialOrd>(&mut self, a: T, min: T, max: T) -> &mut Self;
fn vec_contains<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Self;
fn program(&mut self, p: &str) -> &mut Self;
fn not_program(&mut self, p: &str) -> &mut Self;
fn vec_no_contains<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Self;
fn option_contains<T: PartialEq>(&mut self, a: Option<T>, b: T) -> &mut Self;
fn hash_contains(&mut self, a: &mut HashSet<String>, b: String) -> &mut Self;
fn string_contains(&mut self, a: &str, b: &str) -> &mut Self;
fn file_contains(&mut self, f: &str, v: &str) -> &mut Self;
fn exists(&mut self, p: &str) -> &mut Self;
fn not_exists(&mut self, p: &str) -> &mut Self;
fn begin_with(&mut self, actual: &str, expected: &str) -> &mut Self;
fn end_with(&mut self, actual: &str, expected: &str) -> &mut Self;
fn end(&mut self) -> bool;
}Expand description
§The method to implements for a new struct
Required Methods§
sourcefn matches(&mut self, pattern: &str, values: Vec<String>) -> &mut Self
fn matches(&mut self, pattern: &str, values: Vec<String>) -> &mut Self
§Check if a pattern matches values
patternThe pattern to matchvaluesThe values to check
sourcefn capture(
&mut self,
pattern: &str,
x: &str,
key: usize,
values: Vec<String>
) -> &mut Self
fn capture( &mut self, pattern: &str, x: &str, key: usize, values: Vec<String> ) -> &mut Self
§check if a pattern a the x index equal a value listing in values
patternThe pattern to matchxThe index to matchvaluesThe values
sourcefn it(
describe: &str,
sleep_time: u64,
callbacks: Vec<&dyn Fn(&mut Self) -> &mut Self>
)
fn it( describe: &str, sleep_time: u64, callbacks: Vec<&dyn Fn(&mut Self) -> &mut Self> )
§Constructor
callbacksThe vec list of callbackdescribeThe description
sourcefn ok(&mut self, f: &dyn Fn() -> bool) -> &mut Self
fn ok(&mut self, f: &dyn Fn() -> bool) -> &mut Self
§Assert if callback return true
fThe callback
sourcefn ko(&mut self, f: &dyn Fn() -> bool) -> &mut Self
fn ko(&mut self, f: &dyn Fn() -> bool) -> &mut Self
§Assert if callback return false
fThe callback
sourcefn equals<T: PartialEq>(&mut self, a: T, b: T) -> &mut Self
fn equals<T: PartialEq>(&mut self, a: T, b: T) -> &mut Self
§Check if a and b are equals
aThe first valuebThe second value
sourcefn unequals<T: PartialEq>(&mut self, a: T, b: T) -> &mut Self
fn unequals<T: PartialEq>(&mut self, a: T, b: T) -> &mut Self
§Check if a and b are unequals
aThe first valuebThe second value
sourcefn superior<T: PartialOrd>(&mut self, a: T, min: T) -> &mut Self
fn superior<T: PartialOrd>(&mut self, a: T, min: T) -> &mut Self
§Check if a are superior to min
aThe first valueminThe minimum value
sourcefn inferior<T: PartialOrd>(&mut self, a: T, max: T) -> &mut Self
fn inferior<T: PartialOrd>(&mut self, a: T, max: T) -> &mut Self
§Check if a are inferior to max
aThe first valuemaxThe maximum value
sourcefn between<T: PartialOrd>(&mut self, a: T, min: T, max: T) -> &mut Self
fn between<T: PartialOrd>(&mut self, a: T, min: T, max: T) -> &mut Self
§Check if a are between min and max
aThe first valueminThe minimum valuemaxThe maximum value
sourcefn vec_contains<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Self
fn vec_contains<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Self
§Check if a vector contains a value
aThe vectorbThe value to check
sourcefn not_program(&mut self, p: &str) -> &mut Self
fn not_program(&mut self, p: &str) -> &mut Self
§Check if p is not a program
pThe program to test
sourcefn vec_no_contains<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Self
fn vec_no_contains<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Self
§Check if a vector not contains a value
aThe vectorbThe value to check
sourcefn option_contains<T: PartialEq>(&mut self, a: Option<T>, b: T) -> &mut Self
fn option_contains<T: PartialEq>(&mut self, a: Option<T>, b: T) -> &mut Self
§Check if a option contains a value
aThe vectorbThe value to check
sourcefn hash_contains(&mut self, a: &mut HashSet<String>, b: String) -> &mut Self
fn hash_contains(&mut self, a: &mut HashSet<String>, b: String) -> &mut Self
§Check if a hash contains a string
aThe hashbThe value to find
sourcefn string_contains(&mut self, a: &str, b: &str) -> &mut Self
fn string_contains(&mut self, a: &str, b: &str) -> &mut Self
§Check if a sting contains a substring
aThe stringbThe substring
sourcefn file_contains(&mut self, f: &str, v: &str) -> &mut Self
fn file_contains(&mut self, f: &str, v: &str) -> &mut Self
§Check if a file contains a value
fThe filevThe value to check
sourcefn not_exists(&mut self, p: &str) -> &mut Self
fn not_exists(&mut self, p: &str) -> &mut Self
§Check if a path not exist
pThe path to check the no existence
sourcefn begin_with(&mut self, actual: &str, expected: &str) -> &mut Self
fn begin_with(&mut self, actual: &str, expected: &str) -> &mut Self
§Check if a string begin with the expected value
actualThe actual valueexpectedThe expected value
Object Safety§
This trait is not object safe.