diff --git a/src/lib.rs b/src/lib.rs index b0754c3..4e979e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,3 +13,16 @@ mod sharry; pub use appstate::AppState; pub use cli::Cli; pub use error::{Error, Parameter, Result}; + +#[cfg(test)] +#[inline] +pub fn check_trait(expected: &E, actual: &A, tr: &'static str, ty: &'static str) +where + E: std::fmt::Debug + PartialEq, + A: std::fmt::Debug, +{ + assert_eq!( + expected, actual, + "`impl {tr} for {ty}` expected: {expected:?}, actual: {actual:?}", + ); +} diff --git a/src/sharry/ids.rs b/src/sharry/ids.rs index fc63f16..8f2324c 100644 --- a/src/sharry/ids.rs +++ b/src/sharry/ids.rs @@ -102,18 +102,7 @@ impl TryFrom for FileID { #[cfg(test)] mod tests { use super::*; - - #[inline] - fn check_trait(expected: &E, actual: &A, tr: &'static str, ty: &'static str) - where - E: fmt::Debug + PartialEq, - A: fmt::Debug, - { - assert_eq!( - expected, actual, - "`impl {tr} for {ty}` expected: {expected:?}, actual: {actual:?}", - ); - } +use crate::check_trait; #[test] fn basic_traits_working() {