mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
Add initial tests
This commit is contained in:
parent
667a69279e
commit
cb56872566
1 changed files with 21 additions and 2 deletions
|
@ -3,6 +3,25 @@ use crate::helpers::llvm::assert_evals_to_erased;
|
||||||
|
|
||||||
use indoc::indoc;
|
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]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm"))]
|
||||||
fn multi_branch_capturing() {
|
fn multi_branch_capturing() {
|
||||||
|
@ -13,13 +32,13 @@ fn multi_branch_capturing() {
|
||||||
|
|
||||||
f = \t, s ->
|
f = \t, s ->
|
||||||
if t
|
if t
|
||||||
then \{} -> 0
|
then \{} -> 15nat
|
||||||
else \{} -> Str.countGraphemes s
|
else \{} -> Str.countGraphemes s
|
||||||
|
|
||||||
main = ((f Bool.true "abc") {}, (f Bool.false "abc") {})
|
main = ((f Bool.true "abc") {}, (f Bool.false "abc") {})
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
(0, 3),
|
(15, 3),
|
||||||
(usize, usize)
|
(usize, usize)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue