mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Merge pull request #6883 from smores56/new-builder-syntax
Implement new builder syntax alongside old one
This commit is contained in:
commit
b9a17f4a49
20 changed files with 1226 additions and 214 deletions
|
@ -1979,7 +1979,99 @@ mod test_fmt {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn record_builder() {
|
||||
fn new_record_builder() {
|
||||
expr_formats_same(indoc!(
|
||||
r"
|
||||
{ shoes <- leftShoe: nothing }
|
||||
"
|
||||
));
|
||||
|
||||
expr_formats_to(
|
||||
indoc!(
|
||||
r"
|
||||
{ shoes <- rightShoe : nothing }
|
||||
"
|
||||
),
|
||||
indoc!(
|
||||
r"
|
||||
{ shoes <- rightShoe: nothing }
|
||||
"
|
||||
),
|
||||
);
|
||||
|
||||
expr_formats_to(
|
||||
indoc!(
|
||||
r"
|
||||
{ shoes <- rightShoe : nothing }
|
||||
"
|
||||
),
|
||||
indoc!(
|
||||
r"
|
||||
{ shoes <- rightShoe: nothing }
|
||||
"
|
||||
),
|
||||
);
|
||||
|
||||
expr_formats_same(indoc!(
|
||||
r"
|
||||
{ shoes <-
|
||||
rightShoe,
|
||||
leftShoe: newLeftShoe,
|
||||
}
|
||||
"
|
||||
));
|
||||
|
||||
expr_formats_same(indoc!(
|
||||
r"
|
||||
{ shoes <-
|
||||
# some comment
|
||||
rightShoe,
|
||||
# some other comment
|
||||
leftShoe: newLeftShoe,
|
||||
}
|
||||
"
|
||||
));
|
||||
|
||||
expr_formats_to(
|
||||
indoc!(
|
||||
r"
|
||||
{ shoes
|
||||
<- rightShoe: bareFoot
|
||||
, leftShoe: bareFoot }
|
||||
"
|
||||
),
|
||||
indoc!(
|
||||
r"
|
||||
{ shoes <-
|
||||
rightShoe: bareFoot,
|
||||
leftShoe: bareFoot,
|
||||
}
|
||||
"
|
||||
),
|
||||
);
|
||||
|
||||
expr_formats_to(
|
||||
indoc!(
|
||||
r"
|
||||
{ shoes
|
||||
<- rightShoe: bareFoot, # some comment
|
||||
leftShoe: bareFoot }
|
||||
"
|
||||
),
|
||||
indoc!(
|
||||
r"
|
||||
{ shoes <-
|
||||
rightShoe: bareFoot,
|
||||
# some comment
|
||||
leftShoe: bareFoot,
|
||||
}
|
||||
"
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn old_record_builder() {
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
{ a: 1, b: <- get "b" |> batch, c: <- get "c" |> batch, d }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue