move check_trait to crate root

This commit is contained in:
Jörn-Michael Miehe 2025-07-03 10:32:46 +00:00
parent ad1854dfb8
commit abf76c9df7
2 changed files with 14 additions and 12 deletions

View file

@ -13,3 +13,16 @@ mod sharry;
pub use appstate::AppState; pub use appstate::AppState;
pub use cli::Cli; pub use cli::Cli;
pub use error::{Error, Parameter, Result}; pub use error::{Error, Parameter, Result};
#[cfg(test)]
#[inline]
pub fn check_trait<E, A>(expected: &E, actual: &A, tr: &'static str, ty: &'static str)
where
E: std::fmt::Debug + PartialEq<A>,
A: std::fmt::Debug,
{
assert_eq!(
expected, actual,
"`impl {tr} for {ty}` expected: {expected:?}, actual: {actual:?}",
);
}

View file

@ -102,18 +102,7 @@ impl TryFrom<String> for FileID {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::check_trait;
#[inline]
fn check_trait<E, A>(expected: &E, actual: &A, tr: &'static str, ty: &'static str)
where
E: fmt::Debug + PartialEq<A>,
A: fmt::Debug,
{
assert_eq!(
expected, actual,
"`impl {tr} for {ty}` expected: {expected:?}, actual: {actual:?}",
);
}
#[test] #[test]
fn basic_traits_working() { fn basic_traits_working() {