fix(lexer): treat trailing CR as line end so comment text is idempotent
Test / test (push) Successful in 2m13s
Test / test (push) Successful in 2m13s
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -31,6 +31,12 @@ func FuzzFormatIdempotency(f *testing.F) {
|
||||
f.Add("TEXT ·f(SB), NOSPLIT, $0\n\tMOVQ AX, BX\n\tRET\n")
|
||||
f.Add("TEXT ·f(SB),NOSPLIT,$0\n\tMOVQ AX,BX\n\n\n\tRET\n")
|
||||
f.Add("garbage ### ???\n")
|
||||
// Line-ending whitespace at the edge of a comment: a CR followed by more
|
||||
// trailing whitespace once survived the first pass and disappeared on
|
||||
// re-lexing, so formatting was not idempotent.
|
||||
f.Add("//\r ")
|
||||
f.Add("// loop \r\t\nMOVQ AX, BX\n")
|
||||
f.Add("TEXT ·f(SB), NOSPLIT, $0 // tail\r\n\tMOVQ AX, BX\r\n\tRET\r\n")
|
||||
|
||||
f.Fuzz(func(t *testing.T, src string) {
|
||||
once := Source(src)
|
||||
|
||||
Reference in New Issue
Block a user