Fixed formatting

This commit is contained in:
Syrus
2019-11-21 13:38:22 -08:00
parent aeb66ee48e
commit c3f93f1275
7 changed files with 23 additions and 58 deletions

View File

@ -9,8 +9,7 @@ mod tests {
fn should_detect_emscripten_files() {
const WAST_BYTES: &[u8] = include_bytes!("tests/is_emscripten_true.wast");
let wasm_binary = wat2wasm(WAST_BYTES.to_vec()).expect("Can't convert to wasm");
let module =
compile(&wasm_binary[..]).expect("WASM can't be compiled");
let module = compile(&wasm_binary[..]).expect("WASM can't be compiled");
let module = Arc::new(module);
assert!(is_emscripten_module(&module));
}
@ -19,8 +18,7 @@ mod tests {
fn should_detect_non_emscripten_files() {
const WAST_BYTES: &[u8] = include_bytes!("tests/is_emscripten_false.wast");
let wasm_binary = wat2wasm(WAST_BYTES.to_vec()).expect("Can't convert to wasm");
let module =
compile(&wasm_binary[..]).expect("WASM can't be compiled");
let module = compile(&wasm_binary[..]).expect("WASM can't be compiled");
let module = Arc::new(module);
assert!(!is_emscripten_module(&module));
}

View File

@ -1,15 +1,9 @@
use wabt::wat2wasm;
use wasmer_runtime::{
error,
func,
Global,
Memory,
imports,
compile,
Table,
Ctx,
compile, error, func, imports,
types::{ElementType, MemoryDescriptor, TableDescriptor, Value},
units::Pages,
Ctx, Global, Memory, Table,
};
static EXAMPLE_WASM: &'static [u8] = include_bytes!("simple.wasm");

View File

@ -1,5 +1,5 @@
use wabt::wat2wasm;
use wasmer_runtime::{ImportObject, Instance, compile};
use wasmer_runtime::{compile, ImportObject, Instance};
fn main() {
let instance = create_module_1();
@ -23,8 +23,7 @@ fn create_module_1() -> Instance {
(elem (;1;) (i32.const 9) 1))
"#;
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
let module = compile(&wasm_binary[..])
.expect("WASM can't be compiled");
let module = compile(&wasm_binary[..]).expect("WASM can't be compiled");
module
.instantiate(&generate_imports())
.expect("WASM can't be instantiated")
@ -43,8 +42,7 @@ static IMPORT_MODULE: &str = r#"
pub fn generate_imports() -> ImportObject {
let wasm_binary = wat2wasm(IMPORT_MODULE.as_bytes()).expect("WAST not valid or malformed");
let module = compile(&wasm_binary[..])
.expect("WASM can't be compiled");
let module = compile(&wasm_binary[..]).expect("WASM can't be compiled");
let instance = module
.instantiate(&ImportObject::new())
.expect("WASM can't be instantiated");

View File

@ -21,8 +21,7 @@ mod tests {
(elem (;0;) (i32.const 0) 0))
"#;
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
let module = wasmer_runtime::compile(&wasm_binary[..])
.expect("WASM can't be compiled");
let module = wasmer_runtime::compile(&wasm_binary[..]).expect("WASM can't be compiled");
let instance = module
.instantiate(&ImportObject::new())
.expect("WASM can't be instantiated");

View File

@ -217,21 +217,13 @@ mod tests {
use std::path::PathBuf;
use wabt::script::{Action, Command, CommandKind, ScriptParser, Value};
use wasmer_runtime::{
CompilerConfig,
ImportObject,
LikeNamespace,
Instance,
error::{CompileError},
Export,
Global,
Memory,
Table,
compile_with_config,
error::CompileError,
func, imports,
types::{ElementType, MemoryDescriptor, TableDescriptor},
units::Pages,
Features,
func, imports, Ctx,
compile_with_config,
CompilerConfig, Ctx, Export, Features, Global, ImportObject, Instance, LikeNamespace,
Memory, Table,
};
fn parse_and_run(
@ -306,10 +298,7 @@ mod tests {
},
..Default::default()
};
let module = compile_with_config(
&module.into_vec(),
config,
)
let module = compile_with_config(&module.into_vec(), config)
.expect("WASM can't be compiled");
let i = module
.instantiate(&spectest_import_object)
@ -715,10 +704,7 @@ mod tests {
},
..Default::default()
};
compile_with_config(
&module.into_vec(),
config,
)
compile_with_config(&module.into_vec(), config)
});
match result {
Ok(module) => {
@ -770,10 +756,7 @@ mod tests {
},
..Default::default()
};
compile_with_config(
&module.into_vec(),
config,
)
compile_with_config(&module.into_vec(), config)
});
match result {
@ -824,10 +807,7 @@ mod tests {
},
..Default::default()
};
let module = compile_with_config(
&module.into_vec(),
config,
)
let module = compile_with_config(&module.into_vec(), config)
.expect("WASM can't be compiled");
let result = panic::catch_unwind(AssertUnwindSafe(|| {
module
@ -922,10 +902,7 @@ mod tests {
},
..Default::default()
};
let module = compile_with_config(
&module.into_vec(),
config,
)
let module = compile_with_config(&module.into_vec(), config)
.expect("WASM can't be compiled");
module.instantiate(&spectest_import_object)
}));

View File

@ -1,5 +1,5 @@
#![cfg(test)]
use wasmer_runtime::{compile, Func, Ctx};
use wasmer_runtime::{compile, Ctx, Func};
use wasmer_wasi::{state::*, *};
use std::ffi::c_void;

View File

@ -5,8 +5,7 @@ macro_rules! assert_wasi_output {
use wasmer_wasi::generate_import_object;
let wasm_bytes = include_bytes!($file);
let module = wasmer_runtime::compile(&wasm_bytes[..])
.expect("WASM can't be compiled");
let module = wasmer_runtime::compile(&wasm_bytes[..]).expect("WASM can't be compiled");
let import_object = generate_import_object(vec![], vec![], $po_dir_args, $mapdir_args);