Fix so that only comments doesn't format to empty (#5944)

This commit is contained in:
Jonathan Tran
2025-03-21 20:56:04 -04:00
committed by GitHub
parent 3464f93a30
commit de2b1b3bea
2 changed files with 11 additions and 5 deletions

View File

@ -2039,6 +2039,15 @@ thing = 'foo'
);
}
#[test]
fn test_recast_only_line_comments() {
let code = r#"// comment at start
"#;
let program = crate::parsing::top_level_parse(code).unwrap();
assert_eq!(program.recast(&Default::default(), 0), code);
}
#[test]
fn test_recast_comment_at_start() {
let test_program = r#"