From c55d5c887e8644df1e024573dbcf4e6e819371c2 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 30 Apr 2021 09:43:39 -0700 Subject: [PATCH] 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 Run-TryBot: Robert Griesemer TryBot-Result: Go Bot Reviewed-by: Robert Findley --- src/cmd/compile/internal/types2/check_test.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/cmd/compile/internal/types2/check_test.go b/src/cmd/compile/internal/types2/check_test.go index 61bff28c8e..0ee579062a 100644 --- a/src/cmd/compile/internal/types2/check_test.go +++ b/src/cmd/compile/internal/types2/check_test.go @@ -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 -- 2.50.0