mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-20 15:27:45 +03:00
add tag union tests for trailing commas formatting
This commit is contained in:
parent
7692bd5671
commit
965d151168
@ -415,7 +415,7 @@ pub fn fmt_list<'a>(
|
||||
for item in loc_items.iter() {
|
||||
match &item.value {
|
||||
// TODO?? These SpaceAfter/SpaceBefore litany seems overcomplicated
|
||||
// Can we simplify this?
|
||||
// Can we simplify this? Or at least move this in a separate function.
|
||||
Expr::SpaceBefore(expr_below, spaces_above_expr) => {
|
||||
newline(buf, item_indent);
|
||||
fmt_comments_only(
|
||||
|
@ -2452,22 +2452,54 @@ mod test_fmt {
|
||||
));
|
||||
}
|
||||
|
||||
// TODO This raises a parse error:
|
||||
// NotYetImplemented("TODO the : in this declaration seems outdented")
|
||||
// #[test]
|
||||
// fn multiline_tag_union_annotation() {
|
||||
// expr_formats_same(indoc!(
|
||||
// r#"
|
||||
// b :
|
||||
// [
|
||||
// True,
|
||||
// False,
|
||||
// ]
|
||||
#[test]
|
||||
fn multiline_tag_union_annotation() {
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
b :
|
||||
[
|
||||
True,
|
||||
False,
|
||||
]
|
||||
|
||||
// b
|
||||
// "#
|
||||
// ));
|
||||
// }
|
||||
b
|
||||
"#
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multiline_tag_union_annotation_with_final_comment() {
|
||||
expr_formats_to(
|
||||
indoc!(
|
||||
r#"
|
||||
b :
|
||||
[
|
||||
True,
|
||||
# comment 1
|
||||
False # comment 2
|
||||
,
|
||||
# comment 3
|
||||
]
|
||||
|
||||
b
|
||||
"#
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
b :
|
||||
[
|
||||
True,
|
||||
# comment 1
|
||||
False,
|
||||
# comment 2
|
||||
# comment 3
|
||||
]
|
||||
|
||||
b
|
||||
"#
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tag_union() {
|
||||
|
Loading…
Reference in New Issue
Block a user