Improve naming of Error variants in iced_test
This commit is contained in:
parent
ed873514e5
commit
1c54f5e3e9
3 changed files with 9 additions and 10 deletions
|
|
@ -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<dyn std::fmt::Debug + Send + Sync>,
|
||||
},
|
||||
/// 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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue