Fulu EF tests v1.6.0-alpha.0 (#7540)

Update to EF tests v1.6.0-alpha.0
This commit is contained in:
ethDreamer
2025-06-04 01:34:12 -05:00
committed by GitHub
parent 357a8ccbb9
commit 2d9fc34d43
21 changed files with 494 additions and 167 deletions

View File

@@ -1,4 +1,5 @@
use super::*;
use context_deserialize::ContextDeserialize;
use fs2::FileExt;
use snap::raw::Decoder;
use std::fs::{self};
@@ -35,6 +36,27 @@ pub fn yaml_decode<T: serde::de::DeserializeOwned>(string: &str) -> Result<T, Er
serde_yaml::from_str(string).map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))
}
pub fn context_yaml_decode<'de, T, C>(string: &'de str, context: C) -> Result<T, Error>
where
T: ContextDeserialize<'de, C>,
{
let deserializer = serde_yaml::Deserializer::from_str(string);
T::context_deserialize(deserializer, context)
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))
}
pub fn context_yaml_decode_file<T, C>(path: &Path, context: C) -> Result<T, Error>
where
T: for<'de> ContextDeserialize<'de, C>,
{
log_file_access(path);
fs::read_to_string(path)
.map_err(|e| {
Error::FailedToParseTest(format!("Unable to load {}: {:?}", path.display(), e))
})
.and_then(|s| context_yaml_decode(&s, context))
}
pub fn yaml_decode_file<T: serde::de::DeserializeOwned>(path: &Path) -> Result<T, Error> {
log_file_access(path);
fs::read_to_string(path)