2025-07-04 23:55:26 +00:00
|
|
|
#![cfg(test)]
|
|
|
|
|
|
2025-07-05 01:24:53 +00:00
|
|
|
pub mod data;
|
|
|
|
|
|
2025-07-04 23:55:26 +00:00
|
|
|
use std::{fmt, io::Write};
|
|
|
|
|
|
|
|
|
|
use tempfile::NamedTempFile;
|
|
|
|
|
|
|
|
|
|
pub 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:?}",
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 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
|
|
|
|
|
}
|