Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Nov 21, 2019
1 parent aeb66ee commit c3f93f1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 58 deletions.
6 changes: 2 additions & 4 deletions lib/emscripten-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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));
}
Expand Down
10 changes: 2 additions & 8 deletions lib/spectests/examples/simple/main.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
8 changes: 3 additions & 5 deletions lib/spectests/examples/test.rs
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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")
Expand All @@ -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");
Expand Down
3 changes: 1 addition & 2 deletions lib/spectests/tests/semantics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
49 changes: 13 additions & 36 deletions lib/spectests/tests/spectest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -306,11 +298,8 @@ mod tests {
},
..Default::default()
};
let module = compile_with_config(
&module.into_vec(),
config,
)
.expect("WASM can't be compiled");
let module = compile_with_config(&module.into_vec(), config)
.expect("WASM can't be compiled");
let i = module
.instantiate(&spectest_import_object)
.expect("WASM can't be instantiated");
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -770,10 +756,7 @@ mod tests {
},
..Default::default()
};
compile_with_config(
&module.into_vec(),
config,
)
compile_with_config(&module.into_vec(), config)
});

match result {
Expand Down Expand Up @@ -824,11 +807,8 @@ mod tests {
},
..Default::default()
};
let module = compile_with_config(
&module.into_vec(),
config,
)
.expect("WASM can't be compiled");
let module = compile_with_config(&module.into_vec(), config)
.expect("WASM can't be compiled");
let result = panic::catch_unwind(AssertUnwindSafe(|| {
module
.instantiate(&spectest_import_object)
Expand Down Expand Up @@ -922,11 +902,8 @@ mod tests {
},
..Default::default()
};
let module = compile_with_config(
&module.into_vec(),
config,
)
.expect("WASM can't be compiled");
let module = compile_with_config(&module.into_vec(), config)
.expect("WASM can't be compiled");
module.instantiate(&spectest_import_object)
}));
match result {
Expand Down
2 changes: 1 addition & 1 deletion lib/wasi-tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 1 addition & 2 deletions lib/wasi-tests/tests/wasitests/_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c3f93f1

Please sign in to comment.