#![cfg(test)] use std::{fmt, io::Write}; use tempfile::NamedTempFile; pub 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:?}", ); } /// Helper to create a temp file from `data` pub fn create_file(data: &[u8]) -> NamedTempFile { let mut tmp = NamedTempFile::new().expect("creating temp file"); tmp.write_all(data).expect("writing to tempfile"); tmp }