mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Add tests
This commit is contained in:
parent
d678f1c049
commit
2a71dccf5e
1 changed files with 56 additions and 0 deletions
|
@ -147,6 +147,62 @@ mod test_fmt {
|
|||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shebang_comment() {
|
||||
// Correct shebangs are left alone
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
#!/usr/bin/env roc
|
||||
x = 0
|
||||
|
||||
x
|
||||
"#
|
||||
));
|
||||
|
||||
// Incorrect shebang formatting from the past is fixed
|
||||
expr_formats_to(
|
||||
indoc!(
|
||||
r#"
|
||||
# !/usr/bin/env roc
|
||||
x = 0
|
||||
|
||||
x
|
||||
"#
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
#!/usr/bin/env roc
|
||||
x = 0
|
||||
|
||||
x
|
||||
"#
|
||||
),
|
||||
);
|
||||
|
||||
// Other whitespace from the user is left alone
|
||||
expr_formats_to(
|
||||
&format!(
|
||||
indoc!(
|
||||
r#"
|
||||
# !/usr/bin/env roc{space}
|
||||
x = 0
|
||||
|
||||
x
|
||||
"#
|
||||
),
|
||||
space = " "
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
# !/usr/bin/env roc
|
||||
x = 0
|
||||
|
||||
x
|
||||
"#
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn comment_with_trailing_space() {
|
||||
expr_formats_to(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue