mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
wasm tests: use wasmer .unwrap_i32
This commit is contained in:
parent
a4d83f6916
commit
603c98d1d9
3 changed files with 4 additions and 16 deletions
|
@ -492,10 +492,7 @@ where
|
||||||
match test_wrapper.call(&[]) {
|
match test_wrapper.call(&[]) {
|
||||||
Err(e) => Err(format!("call to `test_wrapper`: {:?}", e)),
|
Err(e) => Err(format!("call to `test_wrapper`: {:?}", e)),
|
||||||
Ok(result) => {
|
Ok(result) => {
|
||||||
let address = match result[0] {
|
let address = result[0].unwrap_i32();
|
||||||
wasmer::Value::I32(a) => a,
|
|
||||||
_ => panic!(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let output = <T as crate::helpers::llvm::FromWasmerMemory>::decode(
|
let output = <T as crate::helpers::llvm::FromWasmerMemory>::decode(
|
||||||
memory,
|
memory,
|
||||||
|
|
|
@ -194,10 +194,7 @@ where
|
||||||
match test_wrapper.call(&[]) {
|
match test_wrapper.call(&[]) {
|
||||||
Err(e) => Err(format!("{:?}", e)),
|
Err(e) => Err(format!("{:?}", e)),
|
||||||
Ok(result) => {
|
Ok(result) => {
|
||||||
let address = match result[0] {
|
let address = result[0].unwrap_i32();
|
||||||
wasmer::Value::I32(a) => a,
|
|
||||||
_ => panic!(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if false {
|
if false {
|
||||||
println!("test_wrapper returned 0x{:x}", address);
|
println!("test_wrapper returned 0x{:x}", address);
|
||||||
|
@ -239,10 +236,7 @@ where
|
||||||
let init_result = init_refcount_test.call(&[wasmer::Value::I32(expected_len)]);
|
let init_result = init_refcount_test.call(&[wasmer::Value::I32(expected_len)]);
|
||||||
let refcount_vector_addr = match init_result {
|
let refcount_vector_addr = match init_result {
|
||||||
Err(e) => return Err(format!("{:?}", e)),
|
Err(e) => return Err(format!("{:?}", e)),
|
||||||
Ok(result) => match result[0] {
|
Ok(result) => result[0].unwrap_i32(),
|
||||||
wasmer::Value::I32(a) => a,
|
|
||||||
_ => panic!(),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Run the test
|
// Run the test
|
||||||
|
|
|
@ -53,10 +53,7 @@ fn wasmer_run_app() -> u32 {
|
||||||
|
|
||||||
let result_addr: i32 = match wrapper.call(&[]) {
|
let result_addr: i32 = match wrapper.call(&[]) {
|
||||||
Err(e) => panic!("{:?}", e),
|
Err(e) => panic!("{:?}", e),
|
||||||
Ok(result) => match result[0] {
|
Ok(result) => result[0].unwrap_i32(),
|
||||||
wasmer::Value::I32(a) => a,
|
|
||||||
_ => panic!("Expected an i32 address, got {:?}", result),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
state.result_addr = Some(result_addr as u32);
|
state.result_addr = Some(result_addr as u32);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue