Implement iced_test::run entrypoint for ice testing
This commit is contained in:
parent
e136e14b7c
commit
6a6a2ac8c5
6 changed files with 149 additions and 22 deletions
|
|
@ -36,7 +36,7 @@ pub struct Emulator<P: Program> {
|
|||
#[allow(missing_debug_implementations)]
|
||||
pub enum Event<P: Program> {
|
||||
Action(Action<P::Message>),
|
||||
Failed,
|
||||
Failed(Instruction),
|
||||
Ready,
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ impl<P: Program + 'static> Emulator<P> {
|
|||
|
||||
let mut messages = Vec::new();
|
||||
|
||||
match instruction {
|
||||
match &instruction {
|
||||
Instruction::Interact(interaction) => {
|
||||
let Some(events) = interaction.events(|target| match target {
|
||||
instruction::Target::Point(position) => Some(*position),
|
||||
|
|
@ -234,7 +234,7 @@ impl<P: Program + 'static> Emulator<P> {
|
|||
}
|
||||
}
|
||||
}) else {
|
||||
self.runtime.send(Event::Failed);
|
||||
self.runtime.send(Event::Failed(instruction));
|
||||
self.cache = Some(user_interface.into_cache());
|
||||
return;
|
||||
};
|
||||
|
|
@ -282,7 +282,7 @@ impl<P: Program + 'static> Emulator<P> {
|
|||
self.runtime.send(Event::Ready);
|
||||
}
|
||||
_ => {
|
||||
self.runtime.send(Event::Failed);
|
||||
self.runtime.send(Event::Failed(instruction));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue