Remove serde de-ser constraint from Cases
This commit is contained in:
parent
5a361b852a
commit
035e124a14
@ -1,6 +1,5 @@
|
||||
use super::*;
|
||||
use crate::yaml_decode::*;
|
||||
use serde_derive::Deserialize;
|
||||
use yaml_rust::YamlLoader;
|
||||
|
||||
mod ssz_generic;
|
||||
@ -9,7 +8,7 @@ mod ssz_static;
|
||||
pub use ssz_generic::*;
|
||||
pub use ssz_static::*;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug)]
|
||||
pub struct Cases<T> {
|
||||
pub test_cases: Vec<T>,
|
||||
}
|
||||
@ -23,6 +22,7 @@ impl<T: YamlDecode> YamlDecode for Cases<T> {
|
||||
|
||||
let mut i = 0;
|
||||
loop {
|
||||
// `is_badvalue` indicates when we have reached the end of the YAML list.
|
||||
if doc[i].is_badvalue() {
|
||||
break;
|
||||
} else {
|
||||
|
@ -59,10 +59,12 @@ impl Doc {
|
||||
|
||||
pub fn run_test<T, E: EthSpec>(test_doc_yaml: &String) -> Vec<CaseResult>
|
||||
where
|
||||
Cases<T>: EfTest + serde::de::DeserializeOwned + YamlDecode,
|
||||
Cases<T>: EfTest + YamlDecode,
|
||||
{
|
||||
// Extract only the "test_cases" YAML as a stand-alone string.
|
||||
let test_cases_yaml = extract_yaml_by_key(test_doc_yaml, "test_cases");
|
||||
|
||||
// Pass only the "test_cases" YAML string to `yaml_decode`.
|
||||
let test_cases: Cases<T> = Cases::yaml_decode(&test_cases_yaml.to_string()).unwrap();
|
||||
|
||||
test_cases.test_results::<E>()
|
||||
|
Loading…
Reference in New Issue
Block a user