internal/web/web_test.go
19 lines · 619 bytes
1package web
2
3import "testing"
4
5// Every page template parses with the layout at start-up, so a broken
6// template fails the process rather than the first visit to its page.
7// Package init has already done the work; this asserts it covered every
8// file (#116).
9func TestEveryPageTemplateParses(t *testing.T) {
10 names := Pages()
11 if len(names) < 30 {
12 t.Fatalf("only %d page templates parsed: %v", len(names), names)
13 }
14 for _, want := range []string{"tree.html", "blob.html", "mr.html", "issue.html", "dashboard.html", "registered.html"} {
15 if _, ok := pages[want]; !ok {
16 t.Errorf("%s not parsed", want)
17 }
18 }
19}