removed redundant VMType enum with one variant (#11266)

This commit is contained in:
Marek Kotewicz
2019-11-20 11:11:36 +08:00
committed by GitHub
parent 82c3265858
commit e0091c672a
18 changed files with 29 additions and 117 deletions

View File

@@ -18,7 +18,7 @@ use std::path::Path;
use std::sync::Arc;
use super::test_common::*;
use account_state::{Backend as StateBackend, State};
use evm::{VMType, Finalize};
use evm::Finalize;
use vm::{
self, ActionParams, CallType, Schedule, Ext,
ContractCreateResult, EnvInfo, MessageCallResult,
@@ -235,17 +235,8 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for TestExt<'a, T, V, B>
}
}
fn do_json_test<H: FnMut(&str, HookType)>(path: &Path, json_data: &[u8], h: &mut H) -> Vec<String> {
let vms = VMType::all();
vms
.iter()
.flat_map(|vm| do_json_test_for(path, vm, json_data, h))
.collect()
}
fn do_json_test_for<H: FnMut(&str, HookType)>(
fn do_json_test<H: FnMut(&str, HookType)>(
path: &Path,
vm_type: &VMType,
json_data: &[u8],
start_stop_hook: &mut H
) -> Vec<String> {
@@ -254,13 +245,13 @@ fn do_json_test_for<H: FnMut(&str, HookType)>(
let mut failed = Vec::new();
for (name, vm) in tests.into_iter() {
start_stop_hook(&format!("{}-{}", name, vm_type), HookType::OnStart);
start_stop_hook(&format!("{}", name), HookType::OnStart);
info!(target: "jsontests", "name: {:?}", name);
let mut fail = false;
let mut fail_unless = |cond: bool, s: &str | if !cond && !fail {
failed.push(format!("[{}] {}: {}", vm_type, name, s));
failed.push(format!("{}: {}", name, s));
fail = true
};
@@ -363,7 +354,7 @@ fn do_json_test_for<H: FnMut(&str, HookType)>(
}
};
start_stop_hook(&format!("{}-{}", name, vm_type), HookType::OnStop);
start_stop_hook(&format!("{}", name), HookType::OnStop);
}
for f in &failed {