Infrastructure to test and implement the replacement of an 'expect' failure with an error production

Last command run was 'cargo test expect_fail'
This commit is contained in:
Chelsea Troy 2022-01-16 22:01:17 -06:00
parent 922d8e57c7
commit 085c02ffee
7 changed files with 108 additions and 36 deletions

View file

@ -255,5 +255,27 @@ macro_rules! assert_evals_to {
};
}
#[allow(unused_macros)]
macro_rules! assert_expect_failed {
($src:expr, $expected:expr, $ty:ty, $failures:expr) => {{
use bumpalo::Bump;
use roc_gen_dev::run_jit_function_raw;
let stdlib = roc_builtins::std::standard_stdlib();
let arena = Bump::new();
let (main_fn_name, errors, lib) =
$crate::helpers::dev::helper(&arena, $src, stdlib, true, true);
let transform = |success| {
let expected = $expected;
assert_eq!(&success, &expected);
};
run_jit_function_raw!(lib, main_fn_name, $ty, transform, errors);
todo!("Actually look up the failures and check them")
};
}
#[allow(unused_imports)]
pub(crate) use assert_evals_to;
pub(crate) use assert_expect_failed;