mirror of
https://github.com/fluencelabs/wasmer
synced 2025-03-16 16:20:49 +00:00
lint
This commit is contained in:
parent
65100d19fc
commit
4eb6ad238e
@ -44,28 +44,22 @@ macro_rules! assert_emscripten_output {
|
||||
|
||||
pub fn assert_emscripten_output(wasm_bytes: &[u8], raw_expected_str: &str) {
|
||||
use wasmer_clif_backend::CraneliftCompiler;
|
||||
use wasmer_emscripten::{
|
||||
EmscriptenGlobals,
|
||||
generate_emscripten_env,
|
||||
stdio::StdioCapturer
|
||||
};
|
||||
use wasmer_emscripten::{generate_emscripten_env, stdio::StdioCapturer, EmscriptenGlobals};
|
||||
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_bytes[..], &CraneliftCompiler::new())
|
||||
.expect("WASM can't be compiled");
|
||||
|
||||
let mut emscripten_globals = EmscriptenGlobals::new(&module);
|
||||
let import_object = generate_emscripten_env(&mut emscripten_globals);
|
||||
let mut instance = module.instantiate(&import_object)
|
||||
.map_err(|err| format!("Can't instantiate the WebAssembly module: {:?}", err)).unwrap();
|
||||
let mut instance = module
|
||||
.instantiate(&import_object)
|
||||
.map_err(|err| format!("Can't instantiate the WebAssembly module: {:?}", err))
|
||||
.unwrap();
|
||||
|
||||
let capturer = StdioCapturer::new();
|
||||
|
||||
wasmer_emscripten::run_emscripten_instance(
|
||||
&module,
|
||||
&mut instance,
|
||||
"test",
|
||||
vec![],
|
||||
).expect("run_emscripten_instance finishes");
|
||||
wasmer_emscripten::run_emscripten_instance(&module, &mut instance, "test", vec![])
|
||||
.expect("run_emscripten_instance finishes");
|
||||
|
||||
let raw_output_string = capturer.end().unwrap().0;
|
||||
|
||||
@ -75,10 +69,9 @@ pub fn assert_emscripten_output(wasm_bytes: &[u8], raw_expected_str: &str) {
|
||||
|
||||
let contains_output = output.contains(expected_output);
|
||||
|
||||
assert!(
|
||||
contains_output,
|
||||
"Output: `{}` does not contain expected output: `{}`",
|
||||
output,
|
||||
expected_output
|
||||
);
|
||||
assert!(
|
||||
contains_output,
|
||||
"Output: `{}` does not contain expected output: `{}`",
|
||||
output, expected_output
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user