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
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
......@@ -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 {
......
......@@ -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 {
......
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