golang.org/x/tools@v0.21.0/go/analysis/passes/stdversion/stdversion_test.go (about)

     1  // Copyright 2024 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 stdversion_test
     6  
     7  import (
     8  	"path/filepath"
     9  	"testing"
    10  
    11  	"golang.org/x/tools/go/analysis/analysistest"
    12  	"golang.org/x/tools/go/analysis/passes/stdversion"
    13  	"golang.org/x/tools/internal/testenv"
    14  	"golang.org/x/tools/internal/testfiles"
    15  )
    16  
    17  func Test(t *testing.T) {
    18  	// The test relies on go1.21 std symbols, but the analyzer
    19  	// itself requires the go1.22 implementation of versions.FileVersions.
    20  	testenv.NeedsGo1Point(t, 22)
    21  
    22  	dir := testfiles.ExtractTxtarToTmp(t, filepath.Join(analysistest.TestData(), "test.txtar"))
    23  	analysistest.Run(t, dir, stdversion.Analyzer,
    24  		"example.com/a",
    25  		"example.com/sub",
    26  		"example.com/sub20",
    27  		"example.com/old")
    28  }