Keep the vocabulary out of the page a consumer lands on

This commit is contained in:
2026-09-21 10:27:04 +02:00
committed by Lillem4n
parent aed74498e6
commit 2a6d1df1bf
3 changed files with 17 additions and 9 deletions
+5 -6
View File
@@ -47,14 +47,13 @@ func sourceFiles(t *testing.T) []*ast.File {
func vocabulary(t *testing.T, files []*ast.File) string {
t.Helper()
for _, f := range files {
if f.Doc == nil {
continue
}
if _, section, found := strings.Cut(f.Doc.Text(), "\n# Vocabulary\n"); found {
return section
for _, c := range f.Comments {
if section, found := strings.CutPrefix(c.Text(), "Vocabulary\n"); found {
return section
}
}
}
t.Fatal("no package doc carries a Vocabulary heading, so fence, hold, pin and the rest are defined nowhere a reader of the code meets them")
t.Fatal("no comment opens with a Vocabulary heading, so fence, hold, pin and the rest are defined nowhere a reader of the code meets them")
return ""
}