golang.org/x/tools@v0.21.0/go/analysis/passes/loopclosure/loopclosure_test.go (about) 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 5 package loopclosure_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/loopclosure" 13 "golang.org/x/tools/internal/testenv" 14 "golang.org/x/tools/internal/testfiles" 15 ) 16 17 func Test(t *testing.T) { 18 // legacy loopclosure test expectations are incorrect > 1.21. 19 testenv.SkipAfterGo1Point(t, 21) 20 21 testdata := analysistest.TestData() 22 analysistest.Run(t, testdata, loopclosure.Analyzer, 23 "a", "golang.org/...", "subtests", "typeparams") 24 } 25 26 func TestVersions22(t *testing.T) { 27 testenv.NeedsGo1Point(t, 22) 28 29 txtar := filepath.Join(analysistest.TestData(), "src", "versions", "go22.txtar") 30 dir := testfiles.ExtractTxtarToTmp(t, txtar) 31 analysistest.Run(t, dir, loopclosure.Analyzer, "golang.org/fake/versions") 32 } 33 34 func TestVersions18(t *testing.T) { 35 txtar := filepath.Join(analysistest.TestData(), "src", "versions", "go18.txtar") 36 dir := testfiles.ExtractTxtarToTmp(t, txtar) 37 analysistest.Run(t, dir, loopclosure.Analyzer, "golang.org/fake/versions") 38 }