use crate::{outcome::TestOutcome, test::TestMeta};
pub trait TestScope<'t, Extra> {
fn before_test(&mut self, meta: &'t TestMeta<Extra>) {
let _ = meta;
}
fn after_test(&mut self, meta: &'t TestMeta<Extra>, outcome: &TestOutcome) {
let _ = (meta, outcome);
}
}
pub trait TestScopeFactory<'t, Extra> {
type Scope<'f>: TestScope<'t, Extra> + 'f
where
't: 'f,
Self: 'f;
fn make_scope<'f>(&'f self) -> Self::Scope<'f>
where
't: 'f;
}
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct NoScope;
impl<'t, Extra> TestScope<'t, Extra> for NoScope {}
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct NoScopeFactory;
impl<'t, Extra> TestScopeFactory<'t, Extra> for NoScopeFactory {
type Scope<'f>
= NoScope
where
't: 'f,
Self: 'f;
fn make_scope<'f>(&'f self) -> Self::Scope<'f>
where
't: 'f,
{
NoScope
}
}