diff --git a/src/errors/tests.rs b/src/errors/tests.rs index ac86457..32fd12f 100644 --- a/src/errors/tests.rs +++ b/src/errors/tests.rs @@ -2,7 +2,13 @@ use crate::BoxedError; use super::*; -fn examine_report(report: miette::Report) { +fn examine_report( + error: impl miette::Diagnostic + std::error::Error + std::fmt::Debug + Sync + Send + 'static, +) { + println!("{}", error); + println!("{:?}", error); + // Convert to report + let report: miette::Report = error.into(); println!("{}", report); println!("{:?}", report); // Convert to std::error::Error @@ -13,14 +19,21 @@ fn examine_report(report: miette::Report) { #[test] fn errors_can_be_converted_to_diagnostic() { - examine_report(GracefulShutdownError::ShutdownTimeout::(Box::new([])).into()); - examine_report(GracefulShutdownError::SubsystemsFailed::(Box::new([])).into()); - examine_report(SubsystemJoinError::SubsystemsFailed::(Arc::new([])).into()); - examine_report(SubsystemError::Panicked::("".into()).into()); - examine_report( - SubsystemError::Failed::("".into(), SubsystemFailure("".into())).into(), - ); - examine_report(CancelledByShutdown.into()); + examine_report(GracefulShutdownError::ShutdownTimeout::( + Box::new([]), + )); + examine_report(GracefulShutdownError::SubsystemsFailed::( + Box::new([]), + )); + examine_report(SubsystemJoinError::SubsystemsFailed::( + Arc::new([]), + )); + examine_report(SubsystemError::Panicked::("".into())); + examine_report(SubsystemError::Failed::( + "".into(), + SubsystemFailure("".into()), + )); + examine_report(CancelledByShutdown); } #[test]