mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
add tests
This commit is contained in:
parent
5fca5fe631
commit
74ec3682a2
1 changed files with 43 additions and 6 deletions
|
@ -136,6 +136,7 @@ mod test_gen {
|
||||||
// TODO try deleting this line and seeing if everything still works.
|
// TODO try deleting this line and seeing if everything still works.
|
||||||
builder.append_block_params_for_function_params(block);
|
builder.append_block_params_for_function_params(block);
|
||||||
|
|
||||||
|
dbg!(&mono_expr);
|
||||||
let main_body =
|
let main_body =
|
||||||
roc_gen::crane::build::build_expr(&env, &scope, &mut module, &mut builder, &mono_expr, &procs);
|
roc_gen::crane::build::build_expr(&env, &scope, &mut module, &mut builder, &mono_expr, &procs);
|
||||||
|
|
||||||
|
@ -1114,16 +1115,16 @@ mod test_gen {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn when_on_result() {
|
fn applied_tag_nothing() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
x : Result Int Int
|
Maybe a : [ Just a, Nothing ]
|
||||||
x = Ok 42
|
|
||||||
|
|
||||||
when x is
|
x : Maybe Int
|
||||||
Ok _ -> 0
|
x = Nothing
|
||||||
Err _ -> 4
|
|
||||||
|
0x1
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
1,
|
1,
|
||||||
|
@ -1131,6 +1132,42 @@ mod test_gen {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn applied_tag_just() {
|
||||||
|
assert_evals_to!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
Maybe a : [ Just a, Nothing ]
|
||||||
|
|
||||||
|
y : Maybe Int
|
||||||
|
y = Just 0x4
|
||||||
|
|
||||||
|
0x1
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
1,
|
||||||
|
i64
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #[test]
|
||||||
|
// fn when_on_result() {
|
||||||
|
// assert_evals_to!(
|
||||||
|
// indoc!(
|
||||||
|
// r#"
|
||||||
|
// x : Result Int Int
|
||||||
|
// x = Ok 42
|
||||||
|
//
|
||||||
|
// when x is
|
||||||
|
// Err _ -> 4
|
||||||
|
// Ok _ -> 0
|
||||||
|
// "#
|
||||||
|
// ),
|
||||||
|
// 0,
|
||||||
|
// i64
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic_record() {
|
fn basic_record() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue