From a9db5a73867f676f2f6a1b8fd2bb61d06b0a10f7 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Fri, 30 Apr 2021 14:55:11 -0400 Subject: [PATCH] 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 Run-TryBot: Robert Findley TryBot-Result: Go Bot Reviewed-by: Robert Griesemer --- src/go/types/check_test.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/go/types/check_test.go b/src/go/types/check_test.go index 0f23952380..0bf9b7ae00 100644 --- a/src/go/types/check_test.go +++ b/src/go/types/check_test.go @@ -47,7 +47,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 test files 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 -// -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() - testPkg(t, strings.Split(*testFiles, ","), *goVersion) + testPkg(t, filenames, *goVersion) } func TestLongConstants(t *testing.T) { -- 2.50.0