Insert a newline between block comments and attributes (#6250)
Signed-off-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
@ -192,7 +192,7 @@ impl Node<Annotation> {
|
|||||||
result.push_str(&indentation);
|
result.push_str(&indentation);
|
||||||
result.push_str(comment);
|
result.push_str(comment);
|
||||||
}
|
}
|
||||||
if !comment.ends_with("*/") && !result.ends_with("\n\n") && result != "\n" {
|
if !result.ends_with("\n\n") && result != "\n" {
|
||||||
result.push('\n');
|
result.push('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1022,6 +1022,20 @@ bar = 0
|
|||||||
assert_eq!(output, input);
|
assert_eq!(output, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn recast_annotations_with_block_comment() {
|
||||||
|
let input = r#"/* Start comment
|
||||||
|
|
||||||
|
sdfsdfsdfs */
|
||||||
|
@settings(defaultLengthUnit = in)
|
||||||
|
|
||||||
|
foo = 42
|
||||||
|
"#;
|
||||||
|
let program = crate::parsing::top_level_parse(input).unwrap();
|
||||||
|
let output = program.recast(&Default::default(), 0);
|
||||||
|
assert_eq!(output, input);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_recast_if_else_if_same() {
|
fn test_recast_if_else_if_same() {
|
||||||
let input = r#"b = if false {
|
let input = r#"b = if false {
|
||||||
|
Reference in New Issue
Block a user