mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 10:02:38 +03:00
make exceptions work on linux again
This commit is contained in:
parent
afd3991bc9
commit
725d52f7c6
@ -253,6 +253,7 @@ fn link_linux(
|
||||
.collect::<HashMap<String, String>>(),
|
||||
)
|
||||
.args(&[
|
||||
"--eh-frame-hdr",
|
||||
"-arch",
|
||||
arch_str(target),
|
||||
libcrt_path.join("crti.o").to_str().unwrap(),
|
||||
|
@ -613,19 +613,19 @@ mod gen_num {
|
||||
assert_evals_to!("Num.atan 10", 1.4711276743037347, f64);
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// #[should_panic(expected = r#"Roc failed with message: "integer addition overflowed!"#)]
|
||||
// fn int_overflow() {
|
||||
// assert_evals_to!(
|
||||
// indoc!(
|
||||
// r#"
|
||||
// 9_223_372_036_854_775_807 + 1
|
||||
// "#
|
||||
// ),
|
||||
// 0,
|
||||
// i64
|
||||
// );
|
||||
// }
|
||||
#[test]
|
||||
#[should_panic(expected = r#"Roc failed with message: "integer addition overflowed!"#)]
|
||||
fn int_overflow() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
9_223_372_036_854_775_807 + 1
|
||||
"#
|
||||
),
|
||||
0,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn int_add_checked() {
|
||||
|
@ -885,22 +885,39 @@ mod gen_primitives {
|
||||
);
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// #[should_panic(expected = "Roc failed with message: ")]
|
||||
// fn exception() {
|
||||
// assert_evals_to!(
|
||||
// indoc!(
|
||||
// r#"
|
||||
// if True then
|
||||
// x + z
|
||||
// else
|
||||
// y + z
|
||||
// "#
|
||||
// ),
|
||||
// 3,
|
||||
// i64
|
||||
// );
|
||||
// }
|
||||
#[test]
|
||||
#[should_panic(expected = "Roc failed with message: ")]
|
||||
fn undefined_variable() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
if True then
|
||||
x + z
|
||||
else
|
||||
y + z
|
||||
"#
|
||||
),
|
||||
3,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "Roc failed with message: ")]
|
||||
fn annotation_without_body() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
foo : I64
|
||||
|
||||
|
||||
foo
|
||||
"#
|
||||
),
|
||||
3,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn closure() {
|
||||
|
@ -102,9 +102,19 @@ pub fn helper<'a>(
|
||||
for problem in can_problems.into_iter() {
|
||||
// Ignore "unused" problems
|
||||
match problem {
|
||||
UnusedDef(_, _) | UnusedArgument(_, _, _) | UnusedImport(_, _) => {
|
||||
delayed_errors.push(problem);
|
||||
continue;
|
||||
UnusedDef(_, _)
|
||||
| UnusedArgument(_, _, _)
|
||||
| UnusedImport(_, _)
|
||||
| RuntimeError(_)
|
||||
| ExposedButNotDefined(_) => {
|
||||
delayed_errors.push(problem.clone());
|
||||
|
||||
let report = can_problem(&alloc, module_path.clone(), problem);
|
||||
let mut buf = String::new();
|
||||
|
||||
report.render_color_terminal(&mut buf, &alloc, &palette);
|
||||
|
||||
lines.push(buf);
|
||||
}
|
||||
_ => {
|
||||
let report = can_problem(&alloc, module_path.clone(), problem);
|
||||
@ -138,7 +148,11 @@ pub fn helper<'a>(
|
||||
|
||||
if !lines.is_empty() {
|
||||
println!("{}", lines.join("\n"));
|
||||
assert_eq!(0, 1, "Mistakes were made");
|
||||
|
||||
// only crash at this point if there were no delayed_errors
|
||||
if delayed_errors.is_empty() {
|
||||
assert_eq!(0, 1, "Mistakes were made");
|
||||
}
|
||||
}
|
||||
|
||||
let module = roc_gen::llvm::build::module_from_builtins(context, "app");
|
||||
|
Loading…
Reference in New Issue
Block a user