Preserve comments before header

Closes #4212
This commit is contained in:
Ayaz Hafiz 2022-10-05 08:34:30 -05:00
parent d12568d8e4
commit df3b7cb1b4
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 41 additions and 1 deletions

View file

@ -5615,6 +5615,37 @@ mod test_fmt {
));
}
#[test]
fn leading_comments_preserved() {
module_formats_same(indoc!(
r#"
# hello world
interface Foo
exposes []
imports []
"#
));
module_formats_same(indoc!(
r#"
# hello world
app "test" packages {} imports [] provides [] to "./platform"
"#
));
module_formats_same(indoc!(
r#"
# hello world
platform "hello-world"
requires {} { main : Str }
exposes []
packages {}
imports []
provides [mainForHost]
"#
));
}
// this is a parse error atm
// #[test]
// fn multiline_apply() {