diff --git a/test/src/error.rs b/test/src/error.rs index 4b898e95..520fd1c6 100644 --- a/test/src/error.rs +++ b/test/src/error.rs @@ -10,9 +10,9 @@ use std::sync::Arc; pub enum Error { /// No matching widget was found for the [`Selector`](crate::Selector). #[error("no matching widget was found for the selector: {selector}")] - NotFound { selector: String }, + SelectorNotFound { selector: String }, #[error("the matching target is not visible: {target:?}")] - NotVisible { + TargetNotVisible { target: Arc, }, /// An IO operation failed. @@ -30,7 +30,7 @@ pub enum Error { error: ice::ParseError, }, #[error("the ice test ({file}) failed")] - IceFailed { + IceTestingFailed { file: PathBuf, instruction: Instruction, }, diff --git a/test/src/lib.rs b/test/src/lib.rs index cc74509a..5f4f61dd 100644 --- a/test/src/lib.rs +++ b/test/src/lib.rs @@ -180,16 +180,15 @@ pub fn run( let mut instructions = ice.instructions.into_iter(); loop { - let Some(event) = executor::block_on(receiver.next()) else { - panic!("emulator runtime stopped unexpectedly"); - }; + let event = executor::block_on(receiver.next()) + .expect("emulator runtime should never stop on its own"); match event { emulator::Event::Action(action) => { emulator.perform(&program, action); } emulator::Event::Failed(instruction) => { - return Err(Error::IceFailed { + return Err(Error::IceTestingFailed { file: file.path().to_path_buf(), instruction, }); diff --git a/test/src/simulator.rs b/test/src/simulator.rs index 30f772a6..93b933a5 100644 --- a/test/src/simulator.rs +++ b/test/src/simulator.rs @@ -118,11 +118,11 @@ where match operation.finish() { widget::operation::Outcome::Some(output) => { - output.ok_or(Error::NotFound { + output.ok_or(Error::SelectorNotFound { selector: description, }) } - _ => Err(Error::NotFound { + _ => Err(Error::SelectorNotFound { selector: description, }), } @@ -148,7 +148,7 @@ where let target = self.find(selector)?; let Some(visible_bounds) = target.visible_bounds() else { - return Err(Error::NotVisible { + return Err(Error::TargetNotVisible { target: Arc::new(target), }); };