]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/compile/internal/types2: simplify use of TestManual
authorRobert Griesemer <gri@golang.org>
Fri, 30 Apr 2021 16:43:39 +0000 (09:43 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 30 Apr 2021 17:08:46 +0000 (17:08 +0000)
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>
src/cmd/compile/internal/types2/check_test.go

index 61bff28c8ee58bf20ebec280892ec04a26336d6f..0ee579062af418d414dcb7a8a3ed4d90447ace53 100644 (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