GoPLS Viewer

Home|gopls/go/analysis/passes/tests/tests_test.go
1// Copyright 2018 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
5package tests_test
6
7import (
8    "testing"
9
10    "golang.org/x/tools/internal/analysisinternal"
11
12    "golang.org/x/tools/go/analysis/analysistest"
13    "golang.org/x/tools/go/analysis/passes/tests"
14    "golang.org/x/tools/internal/typeparams"
15)
16
17func Test(t *testing.T) {
18    // In 1.18, diagnostic for Fuzz Tests must not be used by cmd/vet.
19    // So the code for Fuzz tests diagnostics is guarded behind flag analysisinternal.DiagnoseFuzzTests
20    // Turn on the flag DiagnoseFuzzTests for analysis tests and then turn it off.
21    analysisinternal.DiagnoseFuzzTests = true
22    defer func() {
23        analysisinternal.DiagnoseFuzzTests = false
24    }()
25    testdata := analysistest.TestData()
26    pkgs := []string{
27        "a",        // loads "a", "a [a.test]", and "a.test"
28        "b_x_test"// loads "b" and "b_x_test"
29        "divergent",
30    }
31    if typeparams.Enabled {
32        pkgs = append(pkgs"typeparams")
33    }
34    analysistest.Run(ttestdatatests.Analyzerpkgs...)
35}
36
MembersX
Test.testdata
Test.pkgs
testing
analysistest
tests
Test
Test.t
Members
X