Merge pull request #6883 from smores56/new-builder-syntax

Implement new builder syntax alongside old one
This commit is contained in:
Sam Mohr 2024-07-08 11:19:01 -07:00 committed by GitHub
commit b9a17f4a49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 1226 additions and 214 deletions

View file

@ -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 }