...
Source file
src/cmd/relnote/relnote_test.go
1
2
3
4
5 package main
6
7 import (
8 "flag"
9 "internal/testenv"
10 "io/fs"
11 "os"
12 "path/filepath"
13 "testing"
14
15 "golang.org/x/build/relnote"
16 )
17
18 var flagCheck = flag.Bool("check", false, "run API release note checks")
19
20
21 func TestCheckAPIFragments(t *testing.T) {
22 if !*flagCheck {
23 t.Skip("-check not specified")
24 }
25 root := testenv.GOROOT(t)
26 rootFS := os.DirFS(root)
27 files, err := fs.Glob(rootFS, "api/next/*.txt")
28 if err != nil {
29 t.Fatal(err)
30 }
31 t.Logf("checking release notes for %d files in api/next", len(files))
32 docFS := os.DirFS(filepath.Join(root, "doc", "next"))
33
34 for _, apiFile := range files {
35 if err := relnote.CheckAPIFile(rootFS, apiFile, docFS, "doc/next"); err != nil {
36 t.Errorf("%s: %v", apiFile, err)
37 }
38 }
39 }
40
View as plain text