Fix several fmt+parse bugs found by fuzzing

This commit is contained in:
Joshua Warner 2023-02-18 14:32:51 -08:00
parent f0a74636a0
commit b5f284cd78
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
14 changed files with 297 additions and 151 deletions

View file

@ -243,10 +243,11 @@ impl<'a> Input<'a> {
let reformatted = reparsed_ast.format();
if output != reformatted {
eprintln!("Formatting bug; formatting is not stable.\nOriginal code:\n{}\n\nFormatted code:\n{}\n\nAST:\n{:#?}\n\n",
eprintln!("Formatting bug; formatting is not stable.\nOriginal code:\n{}\n\nFormatted code:\n{}\n\nAST:\n{:#?}\n\nReparsed AST:\n{:#?}\n\n",
self.as_str(),
output.as_ref().as_str(),
actual);
actual,
reparsed_ast);
eprintln!("Reformatting the formatted code changed it again, as follows:\n\n");
assert_multiline_str_eq!(output.as_ref().as_str(), reformatted.as_ref().as_str());