mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-02 11:22:19 +00:00
Add some tests for trailing commas in comments
This commit is contained in:
parent
61a05c7059
commit
d2476099a5
1 changed files with 56 additions and 0 deletions
|
@ -199,6 +199,31 @@ mod test_fmt {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn comment_with_trailing_space() {
|
||||||
|
expr_formats_to(
|
||||||
|
&format!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
# first comment{space}
|
||||||
|
x = 0 # second comment{space}
|
||||||
|
|
||||||
|
x
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
space = " ",
|
||||||
|
),
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
# first comment
|
||||||
|
x = 0 # second comment
|
||||||
|
|
||||||
|
x
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn def_with_inline_comment() {
|
fn def_with_inline_comment() {
|
||||||
expr_formats_same(indoc!(
|
expr_formats_same(indoc!(
|
||||||
|
@ -4393,6 +4418,37 @@ mod test_fmt {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn module_defs_with_comments() {
|
||||||
|
module_formats_to(
|
||||||
|
&format!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
interface Foo
|
||||||
|
exposes []
|
||||||
|
imports []
|
||||||
|
|
||||||
|
# comment 1{space}
|
||||||
|
def = "" # comment 2{space}
|
||||||
|
# comment 3{space}
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
space = " "
|
||||||
|
),
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
interface Foo
|
||||||
|
exposes []
|
||||||
|
imports []
|
||||||
|
|
||||||
|
# comment 1
|
||||||
|
def = "" # comment 2
|
||||||
|
# comment 3
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn format_tui_package_config() {
|
fn format_tui_package_config() {
|
||||||
// At one point this failed to reformat.
|
// At one point this failed to reformat.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue