use core::fmt::Debug;
pub trait Termination {
fn terminate(self);
}
impl Termination for () {
fn terminate(self) {}
}
impl<T, E> Termination for Result<T, E>
where
T: Termination,
E: Debug,
{
fn terminate(self) {
match self {
Ok(value) => value.terminate(),
Err(error) => panic!("{error:?}"),
}
}
}
pub enum TestResult {
Success,
Failure,
Ignore
}
impl TestResult {
pub fn is_success(&self) -> bool {
matches!(self, TestResult::Success)
}
pub fn is_ignore(&self) -> bool {
matches!(self, TestResult::Ignore)
}
pub fn is_failure(&self) -> bool {
matches!(self, TestResult::Failure)
}
}