mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/types2: nest all test data under the testdata directory
This matches https://golang.org/cl/314829 for go/types. Change-Id: If3d127af0557bb13d504581920ea03e39db0eb07 Reviewed-on: https://go-review.googlesource.com/c/go/+/314772 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
12eaefead4
commit
948a262455
106 changed files with 6 additions and 5 deletions
|
|
@ -42,8 +42,8 @@ import (
|
||||||
var (
|
var (
|
||||||
haltOnError = flag.Bool("halt", false, "halt on error")
|
haltOnError = flag.Bool("halt", false, "halt on error")
|
||||||
listErrors = flag.Bool("errlist", false, "list errors")
|
listErrors = flag.Bool("errlist", false, "list errors")
|
||||||
testFiles = flag.String("files", "", "comma-separated list of test files")
|
testFiles = flag.String("files", "", "comma-separated list of TestManual")
|
||||||
goVersion = flag.String("lang", "", "Go language version (e.g. \"go1.12\"")
|
goVersion = flag.String("lang", "", "Go language version (e.g. \"go1.12\") for TestManual")
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseFiles(t *testing.T, filenames []string, mode syntax.Mode) ([]*syntax.File, []error) {
|
func parseFiles(t *testing.T, filenames []string, mode syntax.Mode) ([]*syntax.File, []error) {
|
||||||
|
|
@ -239,9 +239,9 @@ func checkFiles(t *testing.T, filenames []string, goVersion string, colDelta uin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestCheck is for manual testing of selected input files, provided with -files.
|
// TestManual is for manual testing of selected input files, provided with -files.
|
||||||
// The accepted Go language version can be controlled with the -lang flag.
|
// The accepted Go language version can be controlled with the -lang flag.
|
||||||
func TestCheck(t *testing.T) {
|
func TestManual(t *testing.T) {
|
||||||
if *testFiles == "" {
|
if *testFiles == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -252,13 +252,14 @@ func TestCheck(t *testing.T) {
|
||||||
|
|
||||||
// TODO(gri) go/types has extra TestLongConstants and TestIndexRepresentability tests
|
// TODO(gri) go/types has extra TestLongConstants and TestIndexRepresentability tests
|
||||||
|
|
||||||
func TestTestdata(t *testing.T) { DefPredeclaredTestFuncs(); testDir(t, "testdata", 75) } // TODO(gri) narrow column tolerance
|
func TestCheck(t *testing.T) { DefPredeclaredTestFuncs(); testDir(t, "check", 75) } // TODO(gri) narrow column tolerance
|
||||||
func TestExamples(t *testing.T) { testDir(t, "examples", 0) }
|
func TestExamples(t *testing.T) { testDir(t, "examples", 0) }
|
||||||
func TestFixedbugs(t *testing.T) { testDir(t, "fixedbugs", 0) }
|
func TestFixedbugs(t *testing.T) { testDir(t, "fixedbugs", 0) }
|
||||||
|
|
||||||
func testDir(t *testing.T, dir string, colDelta uint) {
|
func testDir(t *testing.T, dir string, colDelta uint) {
|
||||||
testenv.MustHaveGoBuild(t)
|
testenv.MustHaveGoBuild(t)
|
||||||
|
|
||||||
|
dir = filepath.Join("testdata", dir)
|
||||||
fis, err := os.ReadDir(dir)
|
fis, err := os.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue