pub struct AppTester<App, Ef>where
App: App,{ /* private fields */ }
Expand description
AppTester is a simplified execution environment for Crux apps for use in tests.
Create an instance of AppTester
with your App
and an Effect
type
using AppTester::default
.
for example:
ⓘ
let app = AppTester::<ExampleApp, ExampleEffect>::default();
Implementations§
source§impl<App, Ef> AppTester<App, Ef>where
App: App,
impl<App, Ef> AppTester<App, Ef>where App: App,
sourcepub fn update(
&self,
event: App::Event,
model: &mut App::Model
) -> Update<Ef, App::Event>
pub fn update( &self, event: App::Event, model: &mut App::Model ) -> Update<Ef, App::Event>
Run the app’s update
function with an event and a model state
You can use the resulting Update
to inspect the effects which were requested
and potential further events dispatched by capabilities.
sourcepub fn resolve<Op: Operation>(
&self,
request: &mut Request<Op>,
value: Op::Output
) -> Result<Update<Ef, App::Event>>
pub fn resolve<Op: Operation>( &self, request: &mut Request<Op>, value: Op::Output ) -> Result<Update<Ef, App::Event>>
Resolve an effect request
from previous update with an operation output.
This potentially runs the app’s update
function if the effect is completed, and
produce another Update
.
Trait Implementations§
Auto Trait Implementations§
impl<App, Ef> RefUnwindSafe for AppTester<App, Ef>where App: RefUnwindSafe, <App as App>::Capabilities: RefUnwindSafe,
impl<App, Ef> !Send for AppTester<App, Ef>
impl<App, Ef> !Sync for AppTester<App, Ef>
impl<App, Ef> Unpin for AppTester<App, Ef>where App: Unpin, <App as App>::Capabilities: Unpin,
impl<App, Ef> UnwindSafe for AppTester<App, Ef>where App: UnwindSafe, <App as App>::Capabilities: UnwindSafe,
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