Format multiline reecord builder fields nicely

This commit is contained in:
Agustin Zubiaga 2023-05-17 12:48:37 -03:00
parent 5edcb31f32
commit 4cd2c957ca
No known key found for this signature in database
2 changed files with 69 additions and 5 deletions

View file

@ -1978,6 +1978,58 @@ mod test_fmt {
);
}
#[test]
fn multiline_record_builder_field() {
expr_formats_to(
indoc!(
r#"
succeed {
a: <- get "a" |> map (\x -> x * 2)
|> batch,
b: <- get "b" |> batch,
c: items
|> List.map \x -> x * 2
}
"#
),
indoc!(
r#"
succeed {
a: <-
get "a"
|> map (\x -> x * 2)
|> batch,
b: <- get "b" |> batch,
c:
items
|> List.map \x -> x * 2,
}
"#
),
);
expr_formats_same(indoc!(
r#"
succeed {
a: # I like to comment in weird places
<- get "a" |> batch,
b: <- get "b" |> batch,
}
"#
));
expr_formats_same(indoc!(
r#"
succeed {
a:
# I like to comment in weird places
<- get "a" |> batch,
b: <- get "b" |> batch,
}
"#
));
}
#[test]
fn outdentable_record_builders() {
expr_formats_to(