From f9d2c2fd692e3aa81b80fbe1d0479866abff54df Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Sat, 28 Mar 2026 08:12:15 -0700 Subject: [PATCH] test/codegen: forbid commas as separators We need to leave the comma in the regexp so we get the entire comment for processing, but report an error if commas are actually used. Change-Id: Ia19a329deda2524cea292d866a84d1bf3b4518c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/760780 Reviewed-by: Junyang Shao Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI Reviewed-by: Paul Murphy Auto-Submit: Keith Randall --- src/cmd/internal/testdir/testdir_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/internal/testdir/testdir_test.go b/src/cmd/internal/testdir/testdir_test.go index 18891f0081..c17b33308d 100644 --- a/src/cmd/internal/testdir/testdir_test.go +++ b/src/cmd/internal/testdir/testdir_test.go @@ -1489,7 +1489,6 @@ var ( // "[\s,]+" matches " " // second reMatchCheck matches "`SUB`" // ")*)" closes started groups; "*" means that there might be other elements in the space-separated list - // (TODO: remove allowance for comma-separation once the repo is all fixed.) rxAsmPlatform = regexp.MustCompile(`(\w+)(/[\w.]+)?(/\w*)?\s*:\s*(` + reMatchCheck + `(?:[\s,]+` + reMatchCheck + `)*)`) // Regexp to extract a single opcoded check @@ -1685,6 +1684,8 @@ func (t test) wantedAsmOpcodes(fn string) asmChecks { t.Errorf("%s:%d: possible unused assembly pattern: %v", t.goFileName(), i+1, tail) } else if strings.Count(comment, "\"")%2 != 0 || strings.Count(comment, "`")%2 != 0 { t.Errorf("%s:%d: unbalanced quotes: %v", t.goFileName(), i+1, comment) + } else if strings.Contains(comment, "\",") || strings.Contains(comment, "`,") { + t.Errorf("%s:%d: comma separator - use space instead: %v", t.goFileName(), i+1, comment) } } comment = ""