mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Format multiline reecord builder fields nicely
This commit is contained in:
parent
5edcb31f32
commit
4cd2c957ca
2 changed files with 69 additions and 5 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue