1
0
mirror of https://github.com/golang/go synced 2024-11-14 06:40:22 -07:00

go/types: simplify use of TestManual

This is a 1:1 port of CL 315689 to go/types.

Change-Id: If71186b3719be8433c9d21b22c51ffde2cadd55b
Reviewed-on: https://go-review.googlesource.com/c/go/+/315849
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Rob Findley 2021-04-30 14:55:11 -04:00 committed by Robert Findley
parent ffc38d8ab4
commit a9db5a7386

View File

@ -47,7 +47,6 @@ 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 for TestManual")
goVersion = flag.String("lang", "", "Go language version (e.g. \"go1.12\") for TestManual") goVersion = flag.String("lang", "", "Go language version (e.g. \"go1.12\") for TestManual")
) )
@ -297,16 +296,23 @@ func checkFiles(t *testing.T, sizes Sizes, goVersion string, filenames []string,
} }
} }
// TestManual is for manual testing of selected input files, provided with // TestManual is for manual testing of input files, provided as a list
// -files. // of arguments after the test arguments (and a separating "--"). For
// instance, to check the files foo.go and bar.go, use:
//
// go test -run Manual -- foo.go bar.go
//
// To get an error list rather than having the test check against
// ERROR comments in the input files, provide the -errlist flag.
// 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 TestManual(t *testing.T) { func TestManual(t *testing.T) {
if *testFiles == "" { filenames := flag.Args()
if len(filenames) == 0 {
return return
} }
testenv.MustHaveGoBuild(t) testenv.MustHaveGoBuild(t)
DefPredeclaredTestFuncs() DefPredeclaredTestFuncs()
testPkg(t, strings.Split(*testFiles, ","), *goVersion) testPkg(t, filenames, *goVersion)
} }
func TestLongConstants(t *testing.T) { func TestLongConstants(t *testing.T) {