Commit 8086e7c6 authored by Rob Pike's avatar Rob Pike

testing: improve the documentation for the -run flag

It's not intuitive, especially in the presence of subtests, so improve the
explanation and extend and explain the examples.

Change-Id: I6c4d3f8944b60b12311d0c0f0a8e952e7c35a9ed
Reviewed-on: https://go-review.googlesource.com/28995Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
parent 9e876861
...@@ -137,13 +137,17 @@ ...@@ -137,13 +137,17 @@
// of the top-level test and the sequence of names passed to Run, separated by // of the top-level test and the sequence of names passed to Run, separated by
// slashes, with an optional trailing sequence number for disambiguation. // slashes, with an optional trailing sequence number for disambiguation.
// //
// The argument to the -run and -bench command-line flags is a slash-separated // The argument to the -run and -bench command-line flags is an unanchored regular
// list of regular expressions that match each name element in turn. // expression that matches the test's name. For tests with multiple slash-separated
// For example: // elements, such as subtests, the argument is itself slash-separated, with
// // expressions matching each name element in turn. Because it is unanchored, an
// go test -run Foo # Run top-level tests matching "Foo". // empty expression matches any string.
// go test -run Foo/A= # Run subtests of Foo matching "A=". // For example, using "matching" to mean "whose name contains":
// go test -run /A=1 # Run all subtests of a top-level test matching "A=1". //
// go test -run '' # Run all tests.
// go test -run Foo # Run top-level tests matching "Foo", such as "TestFooBar".
// go test -run Foo/A= # For top-level tests matching "Foo", run subtests matching "A=".
// go test -run /A=1 # For all top-level tests, run subtests matching "A=1".
// //
// Subtests can also be used to control parallelism. A parent test will only // Subtests can also be used to control parallelism. A parent test will only
// complete once all of its subtests complete. In this example, all tests are // complete once all of its subtests complete. In this example, all tests are
......
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