...
1
2
3
4
5
6
7 package quic
8
9 import (
10 "bytes"
11 "os"
12 "strings"
13 "testing"
14 )
15
16
17
18
19
20
21
22 func TestFiles(t *testing.T) {
23 f, err := os.Open(".")
24 if err != nil {
25 t.Fatal(err)
26 }
27 names, err := f.Readdirnames(-1)
28 if err != nil {
29 t.Fatal(err)
30 }
31 for _, name := range names {
32 if !strings.HasSuffix(name, ".go") {
33 continue
34 }
35 b, err := os.ReadFile(name)
36 if err != nil {
37 t.Fatal(err)
38 }
39
40 if !bytes.Contains(b, []byte("The Go Authors.")) {
41 t.Errorf("%v: missing copyright", name)
42 }
43
44 if name == "doc.go" {
45 continue
46 }
47 if !bytes.Contains(b, []byte("//go:build go1.21")) {
48 t.Errorf("%v: missing constraint on go1.21", name)
49 }
50 }
51 }
52
View as plain text