Debian Codegraph @

gopls/internal/analysis/fillswitch/fillswitch_test.go

raw symbols SCIP
1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
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 // analyzer allows us to test the fillswitch code action using the analysistest
17 // harness.
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 }