31 lines
834 B
Rust
31 lines
834 B
Rust
//! Simple test to verify error conversion works
|
|
use rtx_eval::error::RTXEvalError;
|
|
|
|
#[test]
|
|
fn test_anyhow_to_rtx_error_conversion() {
|
|
let anyhow_error = anyhow::anyhow!("Test error message");
|
|
let rtx_error: RTXEvalError = anyhow_error.into();
|
|
|
|
match rtx_error {
|
|
RTXEvalError::ValidationError { message } => {
|
|
assert!(message.contains("Test error message"));
|
|
}
|
|
_ => panic!("Expected ValidationError"),
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn test_question_mark_operator() {
|
|
fn returns_anyhow_error() -> anyhow::Result<()> {
|
|
Err(anyhow::anyhow!("Test anyhow error"))
|
|
}
|
|
|
|
fn rtx_function() -> rtx_eval::RTXEvalResult<()> {
|
|
returns_anyhow_error()?; // This should work with From<anyhow::Error>
|
|
Ok(())
|
|
}
|
|
|
|
let result = rtx_function();
|
|
assert!(result.is_err());
|
|
}
|