1
0
mirror of https://github.com/golang/go synced 2024-11-11 21:20:21 -07:00

cmd/compile/internal/types2: simplify use of TestManual

Running the TestManual test (for manual debugging) requires
user-provided files as input. Rather than using another flag
(-files) to provide these files, just use the (remaining)
command line arguments.

Change-Id: I9b20d9f1a6a7ce839bbd690c311ce3f0d0a10496
Reviewed-on: https://go-review.googlesource.com/c/go/+/315689
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Robert Griesemer 2021-04-30 09:43:39 -07:00
parent 89bf297b24
commit c55d5c887e

View File

@ -42,7 +42,6 @@ import (
var (
haltOnError = flag.Bool("halt", false, "halt on error")
listErrors = flag.Bool("errlist", false, "list errors")
testFiles = flag.String("files", "", "comma-separated list of TestManual")
goVersion = flag.String("lang", "", "Go language version (e.g. \"go1.12\") for TestManual")
)
@ -239,15 +238,23 @@ func checkFiles(t *testing.T, filenames []string, goVersion string, colDelta uin
}
}
// TestManual is for manual testing of selected input files, provided with -files.
// TestManual is for manual testing of input files, provided as a list
// 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.
func TestManual(t *testing.T) {
if *testFiles == "" {
filenames := flag.Args()
if len(filenames) == 0 {
return
}
testenv.MustHaveGoBuild(t)
DefPredeclaredTestFuncs()
checkFiles(t, strings.Split(*testFiles, ","), *goVersion, 0, testing.Verbose())
checkFiles(t, filenames, *goVersion, 0, testing.Verbose())
}
// TODO(gri) go/types has extra TestLongConstants and TestIndexRepresentability tests