Add a few tests

This commit is contained in:
Anthony Bullard 2025-01-14 16:46:39 -06:00
parent 28a75611fc
commit 4e66910ef8
No known key found for this signature in database

View file

@ -1776,6 +1776,71 @@ mod test_fmt {
);
}
#[test]
fn lambda_returns_record_new_syntax() {
expr_formats_same(indoc!(
r"
to_record = |_| {
x: 1,
y: 2,
z: 3,
}
to_record
"
));
expr_formats_same(indoc!(
r"
func = |_|
{ x: 1, y: 2, z: 3 }
func
"
));
expr_formats_same(indoc!(
r"
to_record = |_|
val = 0
{
x: 1,
y: 2,
z: 3,
}
to_record
"
));
expr_formats_to(
indoc!(
r"
to_record = |_|
{
x: 1,
y: 2,
z: 3,
}
to_record
"
),
indoc!(
r"
to_record = |_| {
x: 1,
y: 2,
z: 3,
}
to_record
"
),
);
}
#[test]
fn lambda_returns_list() {
expr_formats_same(indoc!(