#![allow(dead_code)]
macro_rules! skip_note {
($($arg:tt)*) => {{
use std::io::Write;
let _ = write!(&mut std::io::stderr(), "WARNING: SKIPPED: ");
let _ = writeln!(&mut std::io::stderr(), $($arg)*);
}};
}
pub mod per_scale_fixture;
use std::path::{Path, PathBuf};
pub fn testdata_root() -> PathBuf {
std::env::var("EDGEFIRST_TESTDATA_DIR")
.map(PathBuf::from)
.unwrap_or_else(|_| {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("..")
.join("..")
.join("testdata")
})
}
pub fn read_fixture(path: &Path) -> Option<Vec<u8>> {
let Ok(bytes) = std::fs::read(path) else {
skip_note!("fixture {path:?} not present (run `git lfs pull`)");
return None;
};
if bytes.starts_with(b"version https://git-lfs") {
skip_note!("fixture {path:?} is an LFS pointer (run `git lfs pull`)");
return None;
}
Some(bytes)
}