...
1
2
3
4
5 package directive_test
6
7 import (
8 "testing"
9
10 "golang.org/x/tools/go/analysis"
11 "golang.org/x/tools/go/analysis/analysistest"
12 "golang.org/x/tools/go/analysis/passes/directive"
13 "golang.org/x/tools/internal/testenv"
14 )
15
16 func Test(t *testing.T) {
17 testenv.NeedsGo1Point(t, 16)
18 analyzer := *directive.Analyzer
19 analyzer.Run = func(pass *analysis.Pass) (interface{}, error) {
20 defer func() {
21
22
23
24
25
26
27 var files []string
28 files = append(files, pass.OtherFiles...)
29 files = append(files, pass.IgnoredFiles...)
30 pass.OtherFiles = files
31 }()
32
33 return directive.Analyzer.Run(pass)
34 }
35 analysistest.Run(t, analysistest.TestData(), &analyzer, "a")
36 }
37
View as plain text