godot_testability_runtime/
error.rs1use thiserror::Error;
4
5pub type TestResult<T> = Result<T, TestError>;
7
8#[derive(Error, Debug)]
10pub enum TestError {
11 #[error("Failed to initialize Godot runtime: {0}")]
13 RuntimeInitialization(String),
14
15 #[error("Godot runtime is not available")]
17 RuntimeNotAvailable,
18
19 #[error("Assertion failed: {0}")]
21 AssertionFailed(String),
22
23 #[error("Test failed: {0}")]
25 TestFailure(String),
26
27 #[error("Tests failed: {0}")]
29 TestsFailed(String),
30
31 #[error("Runtime error: {0}")]
33 RuntimeError(String),
34
35 #[error("I/O error: {0}")]
37 Io(#[from] std::io::Error),
38}
39
40impl TestError {
41 pub fn assertion(message: impl Into<String>) -> Self {
43 Self::AssertionFailed(message.into())
44 }
45
46 pub fn failure(message: impl Into<String>) -> Self {
48 Self::TestFailure(message.into())
49 }
50}