fix test panic output formatting

This commit is contained in:
Folkert 2022-07-22 13:33:52 +02:00
parent 0e56753bf1
commit ccd8821acf
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 18 additions and 13 deletions

View file

@ -516,7 +516,7 @@ macro_rules! assert_llvm_evals_to {
use bumpalo::Bump;
use inkwell::context::Context;
use roc_gen_llvm::llvm::build::LlvmBackendMode;
use roc_gen_llvm::run_jit_function;
use roc_gen_llvm::try_run_jit_function;
let arena = Bump::new();
let context = Context::create();
@ -537,7 +537,18 @@ macro_rules! assert_llvm_evals_to {
let given = $transform(success);
assert_eq!(&given, &expected, "LLVM test failed");
};
run_jit_function!(lib, main_fn_name, $ty, transform, errors)
let result = try_run_jit_function!(lib, main_fn_name, $ty, transform, errors);
match result {
Ok(raw) => {
// only if there are no exceptions thrown, check for errors
assert!(errors.is_empty(), "Encountered errors:\n{}", errors);
transform(raw)
}
Err(msg) => panic!("Roc failed with message: \"{}\"", msg),
}
};
($src:expr, $expected:expr, $ty:ty) => {