fix: fmt crashing with comment at end of file

closes #568
This commit is contained in:
rvcas
2023-06-07 15:59:54 -04:00
parent feb2698e5e
commit 1747090931
2 changed files with 18 additions and 1 deletions

View File

@@ -17,6 +17,23 @@ fn assert_fmt(src: &str, expected: &str) {
assert_eq!(out, out2, "formatting isn't idempotent");
}
#[test]
fn comment_at_end_of_file() {
let input = indoc! { r#"
type Foo =
Int
//"#};
let output = indoc! { r#"
type Foo =
Int
//
"#};
assert_fmt(input, output);
}
#[test]
fn test_format_if() {
let src = indoc! {r#"