diff --git a/format/format_test.go b/format/format_test.go index a94f56c..5f03cc5 100644 --- a/format/format_test.go +++ b/format/format_test.go @@ -491,7 +491,11 @@ func stmtSignature(f *ast.File) []string { case *ast.Include: out = append(out, "include "+d.Header.Text) case *ast.Preproc: - out = append(out, "preproc "+d.Raw) + // An unterminated block comment at the end of the file swallows + // the formatter's mandatory final newline, exactly the artifact + // the token view documents as layout; trimming it keeps the + // signature about tokens, not about that newline. + out = append(out, "preproc "+strings.TrimRight(d.Raw, " \t\r\n")) } } for _, s := range f.Orphans { diff --git a/format/testdata/fuzz/FuzzFormatExpansionRoundTrip/062b12d69fb9426b b/format/testdata/fuzz/FuzzFormatExpansionRoundTrip/062b12d69fb9426b new file mode 100644 index 0000000..7fb5b1f --- /dev/null +++ b/format/testdata/fuzz/FuzzFormatExpansionRoundTrip/062b12d69fb9426b @@ -0,0 +1,2 @@ +go test fuzz v1 +string("#/*0")