use kernelx_core::{Error, Result}; use serde_json::json; #[test] fn test_error_display() { let errors = vec![ Error::Config("test error".to_string()), Error::NoContent, Error::RateLimit, Error::Timeout, Error::ValidationError("invalid input".to_string()), Error::InvalidConfig("missing key".to_string()), Error::UnsupportedCapability("Vision".to_string()), Error::ModelNotFound("gpt-5".to_string()), Error::Serialization(serde_json::from_value::(json!(42)).unwrap_err()), ]; for error in errors { assert!(!error.to_string().is_empty()); } } #[test] fn test_error_conversion() { // Test From implementations let env_error = std::env::VarError::NotPresent; let error: Error = env_error.into(); assert!(matches!(error, Error::Environment(_))); let json_error = serde_json::from_str::("invalid").unwrap_err(); let error: Error = json_error.into(); assert!(matches!(error, Error::Serialization(_))); // Test Result type alias let result: Result<()> = Ok(()); assert!(result.is_ok()); let result: Result<()> = Err(Error::NoContent); assert!(result.is_err()); }