Replace custom solution with new (internal) library call.
Change-Id: I53b26a1caf0684b9f5d8d749b10d9f3ba18a3001
Reviewed-on: https://go-review.googlesource.com/11193
Reviewed-by: Damien Neil <dneil@google.com>
"go/importer"
"go/parser"
"go/token"
- "runtime"
+ "internal/testenv"
"strings"
"testing"
. "go/types"
)
-// skipSpecialPlatforms causes the test to be skipped for platforms where
-// builders (build.golang.org) don't have access to compiled packages for
-// import.
-func skipSpecialPlatforms(t *testing.T) {
- switch platform := runtime.GOOS + "-" + runtime.GOARCH; platform {
- case "nacl-amd64p32",
- "nacl-386",
- "nacl-arm",
- "darwin-arm",
- "darwin-arm64":
- t.Skipf("no compiled packages available for import on %s", platform)
- }
-}
-
func pkgFor(path, source string, info *Info) (*Package, error) {
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, path, source, 0)
}
func TestPredicatesInfo(t *testing.T) {
- skipSpecialPlatforms(t)
+ testenv.MustHaveGoBuild(t)
var tests = []struct {
src string
}
func TestScopesInfo(t *testing.T) {
- skipSpecialPlatforms(t)
+ testenv.MustHaveGoBuild(t)
var tests = []struct {
src string
"go/parser"
"go/scanner"
"go/token"
+ "internal/testenv"
"io/ioutil"
"regexp"
"strings"
}
func TestCheck(t *testing.T) {
- skipSpecialPlatforms(t)
+ testenv.MustHaveGoBuild(t)
// Declare builtins for testing.
DefPredeclaredTestFuncs()
"go/importer"
"go/parser"
"go/token"
+ "internal/testenv"
"strings"
"testing"
}
func TestEvalPos(t *testing.T) {
- skipSpecialPlatforms(t)
+ testenv.MustHaveGoBuild(t)
// The contents of /*-style comments are of the form
// expr => value, type
"go/importer"
"go/parser"
"go/token"
+ "internal/testenv"
"sort"
"testing"
}
func TestResolveIdents(t *testing.T) {
- skipSpecialPlatforms(t)
+ testenv.MustHaveGoBuild(t)
sources := []string{
`
"go/parser"
"go/scanner"
"go/token"
+ "internal/testenv"
"io/ioutil"
"os"
"path/filepath"
)
func TestStdlib(t *testing.T) {
- skipSpecialPlatforms(t)
+ testenv.MustHaveGoBuild(t)
start = time.Now()
walkDirs(t, filepath.Join(runtime.GOROOT(), "src"))
}
func TestStdTest(t *testing.T) {
- skipSpecialPlatforms(t)
+ testenv.MustHaveGoBuild(t)
// test/recover4.go is only built for Linux and Darwin.
// TODO(gri) Remove once tests consider +build tags (issue 10370).
}
func TestStdFixed(t *testing.T) {
- skipSpecialPlatforms(t)
+ testenv.MustHaveGoBuild(t)
testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "fixedbugs"),
"bug248.go", "bug302.go", "bug369.go", // complex test instructions - ignore
}
func TestStdKen(t *testing.T) {
- skipSpecialPlatforms(t)
+ testenv.MustHaveGoBuild(t)
testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "ken"))
}
"go/importer"
"go/parser"
"go/token"
+ "internal/testenv"
"testing"
. "go/types"
}
func TestTypeString(t *testing.T) {
- skipSpecialPlatforms(t)
+ testenv.MustHaveGoBuild(t)
var tests []testEntry
tests = append(tests, independentTestTypes...)