| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package fillswitch_test |
| 6 |
|
| 7 |
import ( |
| 8 |
"go/token" |
| 9 |
"testing" |
| 10 |
|
| 11 |
"golang.org/x/tools/go/analysis" |
| 12 |
"golang.org/x/tools/go/analysis/analysistest" |
| 13 |
"golang.org/x/tools/gopls/internal/analysis/fillswitch" |
| 14 |
) |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
var analyzer = &analysis.Analyzer{ |
| 19 |
Name: "fillswitch", |
| 20 |
Doc: "test only", |
| 21 |
Run: func(pass *analysis.Pass) (any, error) { |
| 22 |
for _, f := range pass.Files { |
| 23 |
for _, diag := range fillswitch.Diagnose(f, token.NoPos, token.NoPos, pass.Pkg, pass.TypesInfo) { |
| 24 |
pass.Report(diag) |
| 25 |
} |
| 26 |
} |
| 27 |
return nil, nil |
| 28 |
}, |
| 29 |
URL: "https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/fillswitch", |
| 30 |
RunDespiteErrors: true, |
| 31 |
} |
| 32 |
|
| 33 |
func Test(t *testing.T) { |
| 34 |
testdata := analysistest.TestData() |
| 35 |
analysistest.Run(t, testdata, analyzer, "a") |
| 36 |
} |