test_gen: allow non-llvm tests to expect errors

This commit is contained in:
Brian Carroll 2022-02-09 13:45:25 +00:00
parent 4b585cc6c6
commit abfa4b1522
2 changed files with 23 additions and 13 deletions

View file

@ -3,8 +3,6 @@ use crate::helpers::llvm::assert_evals_to;
#[cfg(feature = "gen-llvm")] #[cfg(feature = "gen-llvm")]
use crate::helpers::llvm::assert_expect_failed; use crate::helpers::llvm::assert_expect_failed;
#[cfg(feature = "gen-llvm")] #[cfg(feature = "gen-llvm")]
use crate::helpers::llvm::assert_llvm_evals_to;
#[cfg(feature = "gen-llvm")]
use crate::helpers::llvm::assert_non_opt_evals_to; use crate::helpers::llvm::assert_non_opt_evals_to;
#[cfg(feature = "gen-dev")] #[cfg(feature = "gen-dev")]
@ -2473,7 +2471,7 @@ fn function_malformed_pattern() {
#[cfg(any(feature = "gen-llvm"))] #[cfg(any(feature = "gen-llvm"))]
#[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_llvm_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
f : I64 -> I64 f : I64 -> I64

View file

@ -590,19 +590,31 @@ macro_rules! assert_llvm_evals_to {
#[allow(unused_macros)] #[allow(unused_macros)]
macro_rules! assert_evals_to { macro_rules! assert_evals_to {
($src:expr, $expected:expr, $ty:ty) => {{ ($src:expr, $expected:expr, $ty:ty) => {{
assert_evals_to!($src, $expected, $ty, $crate::helpers::llvm::identity); assert_evals_to!($src, $expected, $ty, $crate::helpers::llvm::identity, false);
}}; }};
($src:expr, $expected:expr, $ty:ty, $transform:expr) => { ($src:expr, $expected:expr, $ty:ty, $transform:expr) => {{
// same as above, except with an additional transformation argument. // same as above, except with an additional transformation argument.
{ assert_evals_to!($src, $expected, $ty, $transform, false);
#[cfg(feature = "wasm-cli-run")] }};
$crate::helpers::llvm::assert_wasm_evals_to!( ($src:expr, $expected:expr, $ty:ty, $transform:expr, $ignore_problems: expr) => {{
$src, $expected, $ty, $transform, false, false // same as above, except with ignore_problems.
); #[cfg(feature = "wasm-cli-run")]
$crate::helpers::llvm::assert_wasm_evals_to!(
$src,
$expected,
$ty,
$transform,
$ignore_problems
);
$crate::helpers::llvm::assert_llvm_evals_to!($src, $expected, $ty, $transform, false); $crate::helpers::llvm::assert_llvm_evals_to!(
} $src,
}; $expected,
$ty,
$transform,
$ignore_problems
);
}};
} }
#[allow(unused_macros)] #[allow(unused_macros)]