We got a test working for panicking with the appropriate number fo failures. Ultimatly we want:

+ An error maessage that says what the failures were
+ Not panicking (so these are effectively error productions)
This commit is contained in:
Chelsea Troy 2022-01-30 18:55:09 -06:00
parent 085c02ffee
commit 4f8d0776b3
8 changed files with 103 additions and 24 deletions

View file

@ -272,10 +272,9 @@ macro_rules! assert_expect_failed {
};
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;

View file

@ -192,7 +192,11 @@ fn create_llvm_module<'a>(
for function in FunctionIterator::from_module(module) {
let name = function.get_name().to_str().unwrap();
if name.starts_with("roc_builtins") {
function.set_linkage(Linkage::Internal);
if name.starts_with("roc_builtins.utils") {
function.set_linkage(Linkage::External);
} else {
function.set_linkage(Linkage::Internal);
}
}
if name.starts_with("roc_builtins.dict") {
@ -613,19 +617,14 @@ macro_rules! assert_expect_failed {
let stdlib = arena.alloc(roc_builtins::std::standard_stdlib());
let is_gen_test = true;
let (main_fn_name, errors, lib) = $crate::helpers::llvm::helper(
&arena,
$src,
stdlib,
is_gen_test,
false,
&context,
);
let (main_fn_name, errors, lib) =
$crate::helpers::llvm::helper(&arena, $src, stdlib, is_gen_test, false, &context);
let transform = |success| {
let expected = $expected;
assert_eq!(&success, &expected, "LLVM test failed");
};
run_jit_function!(lib, main_fn_name, $ty, transform, errors)
};
@ -644,7 +643,6 @@ macro_rules! assert_expect_failed {
};
}
#[allow(dead_code)]
pub fn identity<T>(value: T) -> T {
value
@ -674,11 +672,10 @@ macro_rules! assert_non_opt_evals_to {
#[allow(unused_imports)]
pub(crate) use assert_evals_to;
#[allow(unused_imports)]
pub(crate) use assert_expect_failed;
#[allow(unused_imports)]
pub(crate) use assert_llvm_evals_to;
#[allow(unused_imports)]
pub(crate) use assert_non_opt_evals_to;
#[allow(unused_imports)]
pub(crate) use assert_wasm_evals_to;
#[allow(unused_imports)]
pub(crate) use assert_expect_failed;