From dda470dc9c26358a180a126aa660592039088901 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 21 Sep 2026 11:17:57 +0200 Subject: [PATCH] Hold the template doc to naming a pass, and name the check for what it does --- doc_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc_test.go b/doc_test.go index 995af0f..728f0f2 100644 --- a/doc_test.go +++ b/doc_test.go @@ -133,12 +133,15 @@ func receiverType(recv *ast.FieldList) string { const fillHeader = "Filled by " -// TestTemplateFieldsNameTheirPass holds a renamed pass to the group it fills. -func TestTemplateFieldsNameTheirPass(t *testing.T) { +// TestTemplateFieldGroupsNameADeclaredPass holds a renamed pass to the group it +// fills, and to the template doc. +func TestTemplateFieldGroupsNameADeclaredPass(t *testing.T) { fset, files := sourceFiles(t) declared := declaredSymbols(files) doc, st, headers := templateStruct(t, fset, files) - namesDeclared(t, "the template doc", doc, declared) + if namesDeclared(t, "the template doc", doc, declared) == 0 { + t.Error("the template doc names no pass, so nothing says when a field is final") + } for _, field := range st.Fields.List { if len(field.Names) == 0 { t.Error("an embedded field of template sits under no header, so nothing says which pass fills it") @@ -150,7 +153,7 @@ func TestTemplateFieldsNameTheirPass(t *testing.T) { continue } if namesDeclared(t, "the header above template."+id.Name, header, declared) == 0 { - t.Errorf("the header above template.%s names no function, so it names no pass", id.Name) + t.Errorf("the header above template.%s names no symbol, so it names no pass", id.Name) } } }