Code redundancy between ext implementation and testing. (#3830)

* fix child_storage_hash

* extract common implementation for ext and testing

* cleaning impl.

* replace ExtBasisMut by actual Ext

* remove extbasis.

* Update tests to use Ext from test externalities.

* use Ext constructor for getting ext from TestExternalities.

* Add missing extensions from ext.

* fix wasmi test

* Fix merge error.
This commit is contained in:
cheme
2019-10-18 09:52:25 +02:00
committed by Bastian Köcher
parent fddfcbacea
commit d9cffa0bb5
8 changed files with 148 additions and 228 deletions
+10
View File
@@ -610,6 +610,7 @@ mod tests {
#[test]
fn sandbox_should_work() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let test_code = WASM_BINARY;
let code = wabt::wat2wasm(r#"
@@ -642,6 +643,7 @@ mod tests {
#[test]
fn sandbox_trap() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let test_code = WASM_BINARY;
let code = wabt::wat2wasm(r#"
@@ -663,6 +665,7 @@ mod tests {
#[test]
fn sandbox_should_trap_when_heap_exhausted() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let test_code = WASM_BINARY;
let code = wabt::wat2wasm(r#"
@@ -691,6 +694,7 @@ mod tests {
#[test]
fn start_called() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let test_code = WASM_BINARY;
let code = wabt::wat2wasm(r#"
@@ -729,6 +733,7 @@ mod tests {
#[test]
fn invoke_args() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let test_code = WASM_BINARY;
let code = wabt::wat2wasm(r#"
@@ -763,6 +768,7 @@ mod tests {
#[test]
fn return_val() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let test_code = WASM_BINARY;
let code = wabt::wat2wasm(r#"
@@ -785,6 +791,7 @@ mod tests {
#[test]
fn unlinkable_module() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let test_code = WASM_BINARY;
let code = wabt::wat2wasm(r#"
@@ -805,6 +812,7 @@ mod tests {
#[test]
fn corrupted_module() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let test_code = WASM_BINARY;
// Corrupted wasm file
@@ -819,6 +827,7 @@ mod tests {
#[test]
fn start_fn_ok() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let test_code = WASM_BINARY;
let code = wabt::wat2wasm(r#"
@@ -842,6 +851,7 @@ mod tests {
#[test]
fn start_fn_traps() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let test_code = WASM_BINARY;
let code = wabt::wat2wasm(r#"