wasm: enable a test that has a Stmt::RuntimeError

This commit is contained in:
Brian Carroll 2022-02-09 13:46:31 +00:00
parent abfa4b1522
commit 0d08c97e44
2 changed files with 20 additions and 33 deletions

View file

@ -2468,7 +2468,7 @@ fn function_malformed_pattern() {
} }
#[test] #[test]
#[cfg(any(feature = "gen-llvm"))] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[should_panic(expected = "Hit an erroneous type when creating a layout for")] #[should_panic(expected = "Hit an erroneous type when creating a layout for")]
fn call_invalid_layout() { fn call_invalid_layout() {
assert_evals_to!( assert_evals_to!(

View file

@ -178,7 +178,7 @@ fn load_bytes_into_runtime(bytes: Vec<u8>) -> wasmer::Instance {
} }
#[allow(dead_code)] #[allow(dead_code)]
pub fn assert_wasm_evals_to_help<T>(src: &str, phantom: PhantomData<T>) -> Result<T, String> pub fn assert_evals_to_help<T>(src: &str, phantom: PhantomData<T>) -> Result<T, String>
where where
T: FromWasmerMemory + Wasm32Result, T: FromWasmerMemory + Wasm32Result,
{ {
@ -315,42 +315,31 @@ pub fn debug_memory_hex(memory: &Memory, address: i32, size: usize) {
} }
#[allow(unused_macros)] #[allow(unused_macros)]
macro_rules! assert_wasm_evals_to { macro_rules! assert_evals_to {
($src:expr, $expected:expr, $ty:ty) => {
$crate::helpers::wasm::assert_evals_to!(
$src,
$expected,
$ty,
$crate::helpers::wasm::identity,
false
)
};
($src:expr, $expected:expr, $ty:ty, $transform:expr) => { ($src:expr, $expected:expr, $ty:ty, $transform:expr) => {
$crate::helpers::wasm::assert_evals_to!($src, $expected, $ty, $transform, false);
};
($src:expr, $expected:expr, $ty:ty, $transform:expr, $ignore_problems: expr) => {{
let phantom = std::marker::PhantomData; let phantom = std::marker::PhantomData;
match $crate::helpers::wasm::assert_wasm_evals_to_help::<$ty>($src, phantom) { let _ = $ignore_problems; // Ignore `ignore_problems`! It is used for LLVM tests.
Err(msg) => panic!("{:?}", msg), match $crate::helpers::wasm::assert_evals_to_help::<$ty>($src, phantom) {
Err(msg) => panic!("{}", msg),
Ok(actual) => { Ok(actual) => {
assert_eq!($transform(actual), $expected) assert_eq!($transform(actual), $expected)
} }
} }
};
($src:expr, $expected:expr, $ty:ty) => {
$crate::helpers::wasm::assert_wasm_evals_to!(
$src,
$expected,
$ty,
$crate::helpers::wasm::identity
);
};
($src:expr, $expected:expr, $ty:ty, $transform:expr) => {
$crate::helpers::wasm::assert_wasm_evals_to!($src, $expected, $ty, $transform);
};
}
#[allow(unused_macros)]
macro_rules! assert_evals_to {
($src:expr, $expected:expr, $ty:ty) => {{
assert_evals_to!($src, $expected, $ty, $crate::helpers::wasm::identity);
}}; }};
($src:expr, $expected:expr, $ty:ty, $transform:expr) => {
// Same as above, except with an additional transformation argument.
{
$crate::helpers::wasm::assert_wasm_evals_to!($src, $expected, $ty, $transform);
}
};
} }
#[allow(dead_code)] #[allow(dead_code)]
@ -379,8 +368,6 @@ macro_rules! assert_refcounts {
#[allow(unused_imports)] #[allow(unused_imports)]
pub(crate) use assert_evals_to; pub(crate) use assert_evals_to;
#[allow(unused_imports)]
pub(crate) use assert_wasm_evals_to;
#[allow(unused_imports)] #[allow(unused_imports)]
pub(crate) use assert_refcounts; pub(crate) use assert_refcounts;