INNER CODE UNIT · Go
TestAnAmendmentPointsBothWays
xo/usql · agents_test.go:242
func TestAnAmendmentPointsBothWays(t *testing.T) {
t.Parallel()
status := make(map[string]string)
for _, d := range decisions(t) {
status[d.num] = d.title + ". " + d.status
}
naming := regexp.MustCompile(`(?i)\b(?:amends|supersedes|superseded by|replaced by|amended by) D(\d+)`)
for _, num := range slices.Sorted(maps.Keys(status)) {
head := status[num]
for _, m := range naming.FindAllStringSubmatch(head, -1) {
other := m[1]
if _, ok := status[other]; !ok {
t.Errorf("D%s names D%s, which is not a decision", num, other)
continue
}
if !strings.Contains(status[other], "D"+num) {
t.Errorf("D%s says %q, and D%s does not mention D%s. An amendment has"+
" to be visible from both sides. See D2.", num, head, other, num)