test(format): keep the expansion signature off the EOF comment newline

An unterminated block comment at the end of a file swallows the
formatter's mandatory final newline, an artifact the token view already
documents as layout; the preproc signature entry now trims it so the
invariant stays about tokens.  The triggering input joins the corpus.

Assisted-by: GLM 5.3
This commit is contained in:
petrbalvin committed 2026-10-07 13:54:42 +02:00
1 parent bbe14dd1ab
commit 715298ed23
2 files changed
+7 -1

No files matched your search

+5 -1
View File
@@ -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 {
@@ -0,0 +1,2 @@
go test fuzz v1
string("#/*0")