From cb5687256646b33e7d82cc341aade2823bd9c968 Mon Sep 17 00:00:00 2001 From: Ayaz Hafiz Date: Wed, 12 Jul 2023 13:41:16 -0500 Subject: [PATCH] Add initial tests --- crates/compiler/test_gen/src/gen_erased.rs | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/compiler/test_gen/src/gen_erased.rs b/crates/compiler/test_gen/src/gen_erased.rs index fd5df1c324..682089cd87 100644 --- a/crates/compiler/test_gen/src/gen_erased.rs +++ b/crates/compiler/test_gen/src/gen_erased.rs @@ -3,6 +3,25 @@ use crate::helpers::llvm::assert_evals_to_erased; use indoc::indoc; +#[test] +#[cfg(any(feature = "gen-llvm"))] +fn capture_multiple() { + assert_evals_to_erased!( + indoc!( + r#" + app "test" provides [main] to "./platform" + + f = \n, m -> + \{} -> n + m + 15u8 + + main = (f 10u8 20u8) {} + "# + ), + 45, + u8 + ); +} + #[test] #[cfg(any(feature = "gen-llvm"))] fn multi_branch_capturing() { @@ -13,13 +32,13 @@ fn multi_branch_capturing() { f = \t, s -> if t - then \{} -> 0 + then \{} -> 15nat else \{} -> Str.countGraphemes s main = ((f Bool.true "abc") {}, (f Bool.false "abc") {}) "# ), - (0, 3), + (15, 3), (usize, usize) ); }