pub struct EventRunner<System: Debug> { /* private fields */ }Expand description
A runner that allows to run tests specified as event streams
against the given concrete system.
You can implement several instances of StateHandlers
and ActionHandlers for the System, thus allowing your system
to handle several kinds of abstract states or actions.
Implementations§
Source§impl<System: Debug> EventRunner<System>
impl<System: Debug> EventRunner<System>
Sourcepub fn with_state<State>(self) -> Selfwhere
State: 'static + DeserializeOwned + UnwindSafe + Clone + Debug + PartialEq,
System: 'static + StateHandler<State>,
pub fn with_state<State>(self) -> Selfwhere
State: 'static + DeserializeOwned + UnwindSafe + Clone + Debug + PartialEq,
System: 'static + StateHandler<State>,
Equip the runner with the ability to handle given abstract State.
Sourcepub fn with_action<Action>(self) -> Selfwhere
Action: 'static + DeserializeOwned + UnwindSafe + Clone,
System: 'static + ActionHandler<Action>,
<System as ActionHandler<Action>>::Outcome: 'static + Serialize,
pub fn with_action<Action>(self) -> Selfwhere
Action: 'static + DeserializeOwned + UnwindSafe + Clone,
System: 'static + ActionHandler<Action>,
<System as ActionHandler<Action>>::Outcome: 'static + Serialize,
Equip the runner with the ability to handle given abstract Action.
Sourcepub fn run(
&mut self,
system: &mut System,
stream: &mut dyn Iterator<Item = Event>,
) -> Result<(), TestError>
pub fn run( &mut self, system: &mut System, stream: &mut dyn Iterator<Item = Event>, ) -> Result<(), TestError>
Run the runner on:
- the given concrete
system, which provides storage of concrete system states, as well as the handling of the abstract states and actions; - the given stream of events, representing the test.
Returns the test result.
Trait Implementations§
Auto Trait Implementations§
impl<System> Freeze for EventRunner<System>
impl<System> !RefUnwindSafe for EventRunner<System>
impl<System> !Send for EventRunner<System>
impl<System> !Sync for EventRunner<System>
impl<System> Unpin for EventRunner<System>
impl<System> !UnwindSafe for EventRunner<System>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more