mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
add tests
This commit is contained in:
parent
e82dd43465
commit
6edee521cb
4 changed files with 60 additions and 0 deletions
|
@ -0,0 +1 @@
|
||||||
|
Expr(If(IndentElseBranch(@31), @0), @0)
|
|
@ -0,0 +1,4 @@
|
||||||
|
if thing then
|
||||||
|
whatever
|
||||||
|
else
|
||||||
|
something better
|
|
@ -3628,6 +3628,60 @@ mod test_fmt {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn early_return_else() {
|
||||||
|
expr_formats_same(indoc!(
|
||||||
|
r"
|
||||||
|
if foo then
|
||||||
|
bar
|
||||||
|
else
|
||||||
|
|
||||||
|
baz
|
||||||
|
"
|
||||||
|
));
|
||||||
|
|
||||||
|
expr_formats_to(
|
||||||
|
indoc!(
|
||||||
|
r"
|
||||||
|
if thing then
|
||||||
|
whatever
|
||||||
|
else
|
||||||
|
too close
|
||||||
|
"
|
||||||
|
),
|
||||||
|
indoc!(
|
||||||
|
r"
|
||||||
|
if thing then
|
||||||
|
whatever
|
||||||
|
else
|
||||||
|
|
||||||
|
too close
|
||||||
|
"
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
expr_formats_to(
|
||||||
|
indoc!(
|
||||||
|
r"
|
||||||
|
if isGrowing plant then
|
||||||
|
LetBe
|
||||||
|
else
|
||||||
|
|
||||||
|
Water
|
||||||
|
"
|
||||||
|
),
|
||||||
|
indoc!(
|
||||||
|
r"
|
||||||
|
if isGrowing plant then
|
||||||
|
LetBe
|
||||||
|
else
|
||||||
|
|
||||||
|
Water
|
||||||
|
"
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn multi_line_application() {
|
fn multi_line_application() {
|
||||||
expr_formats_same(indoc!(
|
expr_formats_same(indoc!(
|
||||||
|
|
|
@ -202,6 +202,7 @@ mod test_snapshots {
|
||||||
fail/expression_indentation_end.expr,
|
fail/expression_indentation_end.expr,
|
||||||
fail/if_guard_without_condition.expr,
|
fail/if_guard_without_condition.expr,
|
||||||
fail/if_missing_else.expr,
|
fail/if_missing_else.expr,
|
||||||
|
fail/if_outdented_else_branch.expr,
|
||||||
fail/if_outdented_then.expr,
|
fail/if_outdented_then.expr,
|
||||||
fail/import_with_lowercase_alias.moduledefs,
|
fail/import_with_lowercase_alias.moduledefs,
|
||||||
fail/imports_missing_comma.header,
|
fail/imports_missing_comma.header,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue