| 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 copylock_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/copylock" |
| 13 |
"golang.org/x/tools/internal/testfiles" |
| 14 |
) |
| 15 |
|
| 16 |
func Test(t *testing.T) { |
| 17 |
testdata := analysistest.TestData() |
| •18 |
// TODO(mknyszek): Add "unfortunate" package once CL 627777 lands. That CL changes |
| 19 |
// the internals of the sync package structures to carry an explicit noCopy to prevent |
| 20 |
// problems from changes to the implementations of those structures, such as these |
| 21 |
// tests failing, or a bad user experience. |
| 22 |
analysistest.Run(t, testdata, copylock.Analyzer, "a", "typeparams", "issue67787", "unfortunate") |
| 23 |
} |
| 24 |
|
| 25 |
func TestVersions22(t *testing.T) { |
| 26 |
dir := testfiles.ExtractTxtarFileToTmp(t, filepath.Join(analysistest.TestData(), "src", "forstmt", "go22.txtar")) |
| 27 |
analysistest.Run(t, dir, copylock.Analyzer, "golang.org/fake/forstmt") |
| 28 |
} |
| 29 |
|
| 30 |
func TestVersions21(t *testing.T) { |
| 31 |
dir := testfiles.ExtractTxtarFileToTmp(t, filepath.Join(analysistest.TestData(), "src", "forstmt", "go21.txtar")) |
| 32 |
analysistest.Run(t, dir, copylock.Analyzer, "golang.org/fake/forstmt") |
| 33 |
} |