viewpoint_test/error/
mod.rs1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum TestError {
8 #[error("Core error: {0}")]
10 Core(#[from] viewpoint_core::CoreError),
11
12 #[error("Harness setup failed: {0}")]
14 Setup(String),
15
16 #[error("Harness cleanup failed: {0}")]
18 Cleanup(String),
19
20 #[error("Assertion failed: {0}")]
22 Assertion(#[from] AssertionError),
23
24 #[error("Timeout exceeded after {0:?}")]
26 Timeout(std::time::Duration),
27}
28
29#[derive(Debug, Error)]
31#[error("{message}\n Expected: {expected}\n Actual: {actual}")]
32pub struct AssertionError {
33 pub message: String,
35 pub expected: String,
37 pub actual: String,
39}
40
41impl AssertionError {
42 pub fn new(message: impl Into<String>, expected: impl Into<String>, actual: impl Into<String>) -> Self {
44 Self {
45 message: message.into(),
46 expected: expected.into(),
47 actual: actual.into(),
48 }
49 }
50}