use thiserror::Error;
#[derive(Debug, Error)]
pub enum TestError {
#[error("Core error: {0}")]
Core(#[from] viewpoint_core::CoreError),
#[error("Harness setup failed: {0}")]
Setup(String),
#[error("Harness cleanup failed: {0}")]
Cleanup(String),
#[error("Assertion failed: {0}")]
Assertion(#[from] AssertionError),
#[error("Timeout exceeded after {0:?}")]
Timeout(std::time::Duration),
}
#[derive(Debug, Error)]
#[error("{message}\n Expected: {expected}\n Actual: {actual}")]
pub struct AssertionError {
pub message: String,
pub expected: String,
pub actual: String,
}
impl AssertionError {
pub fn new(
message: impl Into<String>,
expected: impl Into<String>,
actual: impl Into<String>,
) -> Self {
Self {
message: message.into(),
expected: expected.into(),
actual: actual.into(),
}
}
}