...
1
2
3
4
5
6
7
8 package godoc
9
10 import (
11 "bytes"
12 "fmt"
13 "testing"
14 )
15
16
17
18
19
20
21
22
23 func TestStructField(t *testing.T) {
24 for _, n := range []int{10, 100, 1000, 10000} {
25 n := n
26 t.Run(fmt.Sprint(n), func(t *testing.T) {
27 var buf bytes.Buffer
28 fmt.Fprintf(&buf, "package foo\n\ntype T struct {\n")
29 for i := 0; i < n; i++ {
30 fmt.Fprintf(&buf, "\t// Field%d is foo.\n\tField%d int\n\n", i, i)
31 }
32 fmt.Fprintf(&buf, "}\n")
33 linkifySource(t, buf.Bytes())
34 })
35 }
36 }
37
View as plain text