Commit 6d9db54b authored by Gustavo Niemeyer's avatar Gustavo Niemeyer Committed by Rob Pike

testing: rename cmdline flags to avoid conflicts

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