add tests

This commit is contained in:
snobee 2024-09-06 19:34:11 -07:00
parent e82dd43465
commit 6edee521cb
No known key found for this signature in database
GPG key ID: 77D517A21B16CC87
4 changed files with 60 additions and 0 deletions

View file

@ -0,0 +1 @@
Expr(If(IndentElseBranch(@31), @0), @0)

View file

@ -0,0 +1,4 @@
if thing then
whatever
else
something better

View file

@ -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]
fn multi_line_application() {
expr_formats_same(indoc!(

View file

@ -202,6 +202,7 @@ mod test_snapshots {
fail/expression_indentation_end.expr,
fail/if_guard_without_condition.expr,
fail/if_missing_else.expr,
fail/if_outdented_else_branch.expr,
fail/if_outdented_then.expr,
fail/import_with_lowercase_alias.moduledefs,
fail/imports_missing_comma.header,