aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2026-03-28 08:12:15 -0700
committerGopher Robot <gobot@golang.org>2026-03-31 11:01:23 -0700
commitf9d2c2fd692e3aa81b80fbe1d0479866abff54df (patch)
tree1e64c4ce6ab76593265570b13276fbc3a4229a4a
parent1582ad41058df1092eaed9dec4d97b7856953ade (diff)
downloadgo-f9d2c2fd692e3aa81b80fbe1d0479866abff54df.tar.xz
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 <shaojunyang@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Paul Murphy <paumurph@redhat.com> Auto-Submit: Keith Randall <khr@google.com>
-rw-r--r--src/cmd/internal/testdir/testdir_test.go3
1 files changed, 2 insertions, 1 deletions
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 = ""