-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex_test.go
More file actions
47 lines (44 loc) · 810 Bytes
/
index_test.go
File metadata and controls
47 lines (44 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package vanity_test
import (
"bytes"
"testing"
"go.yhsif.com/vanity"
)
func TestIndexTmpl(t *testing.T) {
for _, c := range []struct {
label string
cfg vanity.Config
}{
{
label: "non-empty",
cfg: vanity.Config{
Prefix: "go.yhsif.com",
Mappings: []vanity.Mapping{
{
Path: "/vanity",
URL: "https://github.com/fishy/go-vanity",
Description: "Go vanity URL handler",
},
{
Path: "/url2epub",
URL: "https://github.com/fishy/url2epub",
},
},
},
},
{
label: "empty",
cfg: vanity.Config{},
},
} {
t.Run(c.label, func(t *testing.T) {
var buf bytes.Buffer
err := vanity.IndexTmpl.Execute(&buf, c.cfg)
t.Log("Output:")
t.Log(buf.String())
if err != nil {
t.Error(err)
}
})
}
}