]> Cypherpunks repositories - gostls13.git/commitdiff
testing: rename cmdline flags to avoid conflicts
authorGustavo Niemeyer <gustavo@niemeyer.net>
Fri, 18 Feb 2011 00:17:33 +0000 (16:17 -0800)
committerRob Pike <r@golang.org>
Fri, 18 Feb 2011 00:17:33 +0000 (16:17 -0800)
Flags defined in the testing package may conflict
with real flags defined in the main package, or in
any other imported package.

This change makes them less likely to be used for
other purposes.

R=r, rsc, r2
CC=golang-dev
https://golang.org/cl/4167055

src/cmd/gotest/doc.go
src/pkg/testing/benchmark.go
src/pkg/testing/testing.go

index 40c40fc1fe0ed63b19a89127ef0a400103cc9f4c..8618e804591fe9b285561afa1af67d84ce1cef0c 100644 (file)
@@ -42,15 +42,15 @@ The resulting binary, called (for amd64) 6.out, has a couple of
 arguments.
 
 Usage:
-       6.out [-v] [-match pattern] [-benchmarks pattern]
-
-The -v flag causes the tests to be logged as they run.  The -match
-flag causes only those tests whose names match the regular expression
-pattern to be run. By default all tests are run silently.  If all
-the specified test pass, 6.out prints PASS and exits with a 0 exit
-code.  If any tests fail, it prints FAIL and exits with a non-zero
-code.  The -benchmarks flag is analogous to the -match flag, but
-applies to benchmarks.  No benchmarks run by default.
+       6.out [-test.v] [-test.run pattern] [-test.bench pattern]
+
+The -test.v flag causes the tests to be logged as they run.  The
+-test.run flag causes only those tests whose names match the regular
+expression pattern to be run. By default all tests are run silently.
+If all the specified test pass, 6.out prints PASS and exits with a 0
+exit code.  If any tests fail, it prints FAIL and exits with a
+non-zero code.  The -test.bench flag is analogous to the -test.run
+flag, but applies to benchmarks.  No benchmarks run by default.
 
 */
 package documentation
index ad938027d3eb41c88908fc882decd8e665bff359..8c226c4d41196c36f05bf06a4a597cd8db245634 100644 (file)
@@ -11,7 +11,7 @@ import (
        "time"
 )
 
-var matchBenchmarks = flag.String("benchmarks", "", "regular expression to select benchmarks to run")
+var matchBenchmarks = flag.String("test.bench", "", "regular expression to select benchmarks to run")
 
 // An internal type but exported because it is cross-package; part of the implementation
 // of gotest.
@@ -175,7 +175,7 @@ func RunBenchmarks(matchString func(pat, str string) (bool, os.Error), benchmark
        for _, Benchmark := range benchmarks {
                matched, err := matchString(*matchBenchmarks, Benchmark.Name)
                if err != nil {
-                       println("invalid regexp for -benchmarks:", err.String())
+                       println("invalid regexp for -test.bench:", err.String())
                        os.Exit(1)
                }
                if !matched {
index edbf0847cc05b16c23a2c5c77968daea3f506307..977252baeaa694f73141db0a742dd479d8665093 100644 (file)
@@ -47,8 +47,8 @@ import (
 )
 
 // Report as tests are run; default is silent for success.
-var chatty = flag.Bool("v", false, "verbose: print additional output")
-var match = flag.String("match", "", "regular expression to select tests to run")
+var chatty = flag.Bool("test.v", false, "verbose: print additional output")
+var match = flag.String("test.run", "", "regular expression to select tests to run")
 
 
 // Insert final newline if needed and tabs after internal newlines.
@@ -145,7 +145,7 @@ func Main(matchString func(pat, str string) (bool, os.Error), tests []InternalTe
        for i := 0; i < len(tests); i++ {
                matched, err := matchString(*match, tests[i].Name)
                if err != nil {
-                       println("invalid regexp for -match:", err.String())
+                       println("invalid regexp for -test.run:", err.String())
                        os.Exit(1)
                }
                if !matched {