| 1 |
This directory contains test inputs for the bisect command. |
| 2 |
|
| 3 |
Each text file is a txtar archive (see <https://pkg.go.dev/golang.org/x/tools/txtar> |
| 4 |
or `go doc txtar`). |
| 5 |
|
| 6 |
The comment at the top of the archive is a JSON object describing a |
| 7 |
target behavior. Specifically, the Fail key gives a boolean expression |
| 8 |
that should provoke a failure. Bisect's job is to discover this |
| 9 |
condition. |
| 10 |
|
| 11 |
The Bisect key describes settings in the Bisect struct that we want to |
| 12 |
change, to simulate the use of various command-line options. |
| 13 |
|
| 14 |
The txtar archive files should be "stdout" and "stderr", giving the |
| 15 |
expected standard output and standard error. If the bisect command |
| 16 |
should exit with a non-zero status, the stderr in the archive will end |
| 17 |
with the line "<bisect failed>". |
| 18 |
|
| 19 |
Running `go test -update` will rewrite the stdout and stderr files in |
| 20 |
each testdata archive to match the current state of the tool. This is |
| 21 |
a useful command when the logging prints from bisect change or when |
| 22 |
writing a new test. |
| 23 |
|
| 24 |
To use `go test -update` to write a new test: |
| 25 |
|
| 26 |
- Create a new .txt file with just a JSON object at the top, |
| 27 |
specifying what you want to test. |
| 28 |
- Run `go test -update`. |
| 29 |
- Reload the .txt file and read the stdout and stderr to see if you agree. |