Files
mesh-catalog/checks/words/main_test.go
T
jochen 362974244e
mesh/merge-gate pass: the change touches no module of the mesh's graph
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery delivered
mesh/delivery-group group fix/words-match-plurals delivered: every member is delivered
Hold a retired word's plural to the word in what the tools say (hq ADR 0244)
The pattern ended at the word, so control planes and flavors passed where
control plane and flavor fail. It now takes s or es on the last part; a
test holds it, and merge-check runs that test before the check.
2026-10-07 21:08:33 +02:00

27 lines
819 B
Go

package main
import "testing"
// A retired word's plural is the word; anything else joined on is another word.
func TestPatternMatchesTheWordAndItsPlural(t *testing.T) {
cases := []struct {
word, text string
want bool
}{
{"control plane", "ask the control plane", true},
{"control plane", "two control planes", true},
{"control plane", "two control\n\tplanes", true},
{"substrate", "the substrates", true},
{"flavor", "flavors of a module", true},
{"flavor", "flavored", false},
{"node tools", "node toolsets", false},
{"mesh-console", "the mesh-consoles", true},
{"mesh-console", "mesh-console-x", false},
}
for _, c := range cases {
if got := pattern(c.word).MatchString(c.text); got != c.want {
t.Errorf("pattern(%q) on %q = %v, want %v", c.word, c.text, got, c.want)
}
}
}