1
0
mirror of https://github.com/golang/go synced 2024-09-30 02:24:43 -06:00

go/types: migrate importer usage in tests

To use an importer that knows where to find stdlib .a files based on
their new locations once the checked-in .a files are removed.

Change-Id: I981812306b3512380d58cb0f599a9a61b27ba0d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/442695
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Michael Matloob 2022-10-12 19:09:43 -04:00
parent 7ea0520234
commit 4ac413ae22
4 changed files with 11 additions and 0 deletions

View File

@ -578,6 +578,8 @@ func TestIssue44515(t *testing.T) {
func TestIssue43124(t *testing.T) {
// TODO(rFindley) move this to testdata by enhancing support for importing.
testenv.MustHaveGoBuild(t) // The go command is needed for the importer to determine the locations of stdlib .a files.
// All involved packages have the same name (template). Error messages should
// disambiguate between text/template and html/template by printing the full
// path.

View File

@ -9,6 +9,7 @@ import (
"go/importer"
"go/parser"
"go/token"
"internal/testenv"
"path"
"path/filepath"
"testing"
@ -18,6 +19,8 @@ import (
)
func TestSelf(t *testing.T) {
testenv.MustHaveGoBuild(t) // The Go command is needed for the importer to determine the locations of stdlib .a files.
fset := token.NewFileSet()
files, err := pkgFiles(fset, ".")
if err != nil {
@ -32,6 +35,8 @@ func TestSelf(t *testing.T) {
}
func BenchmarkCheck(b *testing.B) {
testenv.MustHaveGoBuild(b) // The Go command is needed for the importer to determine the locations of stdlib .a files.
for _, p := range []string{
"net/http",
"go/parser",

View File

@ -12,6 +12,7 @@ import (
"go/parser"
"go/token"
"go/types"
"internal/testenv"
"testing"
)
@ -116,6 +117,8 @@ const _ = unsafe.Offsetof(struct{ x int64 }{}.x)
// Issue #53884.
func TestAtomicAlign(t *testing.T) {
testenv.MustHaveGoBuild(t) // The Go command is needed for the importer to determine the locations of stdlib .a files.
const src = `
package main

View File

@ -125,6 +125,7 @@ var dependentTestTypes = []testEntry{
}
func TestTypeString(t *testing.T) {
// The Go command is needed for the importer to determine the locations of stdlib .a files.
testenv.MustHaveGoBuild(t)
var tests []testEntry