X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fgolang.org%2Fx%2Ftools%40v0.1.1-0.20210319172145-bda8f5cee399%2Fgo%2Fanalysis%2Fpasses%2Fbuildtag%2Fbuildtag_test.go;fp=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fgolang.org%2Fx%2Ftools%40v0.1.1-0.20210319172145-bda8f5cee399%2Fgo%2Fanalysis%2Fpasses%2Fbuildtag%2Fbuildtag_test.go;h=163e8e30da3e15f3233cbace5909da2aa1794ab8;hb=3c06164f15bd10aed7d66b6314764a2961a14762;hp=0000000000000000000000000000000000000000;hpb=0e9c3ceb40901f4d44981c1376cb9e23a248e006;p=dotfiles%2F.git diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.1.1-0.20210319172145-bda8f5cee399/go/analysis/passes/buildtag/buildtag_test.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.1.1-0.20210319172145-bda8f5cee399/go/analysis/passes/buildtag/buildtag_test.go new file mode 100644 index 00000000..163e8e30 --- /dev/null +++ b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.1.1-0.20210319172145-bda8f5cee399/go/analysis/passes/buildtag/buildtag_test.go @@ -0,0 +1,39 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package buildtag_test + +import ( + "runtime" + "strings" + "testing" + + "golang.org/x/tools/go/analysis" + "golang.org/x/tools/go/analysis/analysistest" + "golang.org/x/tools/go/analysis/passes/buildtag" +) + +func Test(t *testing.T) { + if strings.HasPrefix(runtime.Version(), "go1.") && runtime.Version() < "go1.16" { + t.Skipf("skipping on %v", runtime.Version()) + } + analyzer := *buildtag.Analyzer + analyzer.Run = func(pass *analysis.Pass) (interface{}, error) { + defer func() { + // The buildtag pass is unusual in that it checks the IgnoredFiles. + // After analysis, add IgnoredFiles to OtherFiles so that + // the test harness checks for expected diagnostics in those. + // (The test harness shouldn't do this by default because most + // passes can't do anything with the IgnoredFiles without type + // information, which is unavailable because they are ignored.) + var files []string + files = append(files, pass.OtherFiles...) + files = append(files, pass.IgnoredFiles...) + pass.OtherFiles = files + }() + + return buildtag.Analyzer.Run(pass) + } + analysistest.Run(t, analysistest.TestData(), &analyzer, "a") +}