add tests

This commit is contained in:
Aidan 2024-07-27 16:59:34 -04:00
parent 7fe052322c
commit 4e4d9b0d4c

View file

@ -6230,6 +6230,32 @@ mod test_fmt {
);
}
#[test]
fn preserve_annotated_body() {
expr_formats_same(
indoc!(
r"
x : i32
x = 1
x
"
)
);
}
#[test]
fn preserve_annotated_body_comment() {
expr_formats_same(
indoc!(
r"
x : i32 # comment
x = 1
x
"
)
);
}
#[test]
fn preserve_annotated_body_comments() {
expr_formats_same(
@ -6245,6 +6271,52 @@ mod test_fmt {
);
}
#[test]
fn preserve_annotated_body_comments_with_newlines() {
expr_formats_same(
indoc!(
r"
x : i32
# comment
# comment 2
x = 1
x
"
)
);
}
#[test]
fn preserve_annotated_body_blank_comment() {
expr_formats_same(
indoc!(
r"
x : i32
#
x = 1
x
"
)
);
}
#[test]
fn preserve_annotated_body_with_newlines() {
expr_formats_same(
indoc!(
r"
x : i32
x = 1
x
"
)
);
}
// this is a parse error atm
// #[test]
// fn multiline_apply() {