tree: 53bf3791926db5491eda64553ce2ca6234a49064 [path history] [tgz]
  1. basic.txt
  2. count2.txt
  3. double.txt
  4. max1.txt
  5. max2.txt
  6. maxset.txt
  7. maxset1.txt
  8. maxset4.txt
  9. negate.txt
  10. rand.txt
  11. rand1.txt
  12. rand2.txt
  13. README.md
cmd/bisect/testdata/README.md

This directory contains test inputs for the bisect command.

Each text file is a txtar archive (see https://pkg.go.dev/golang.org/x/tools/txtar or go doc txtar).

The comment at the top of the archive is a JSON object describing a target behavior. Specifically, the Fail key gives a boolean expression that should provoke a failure. Bisect's job is to discover this condition.

The Bisect key describes settings in the Bisect struct that we want to change, to simulate the use of various command-line options.

The txtar archive files should be “stdout” and “stderr”, giving the expected standard output and standard error. If the bisect command should exit with a non-zero status, the stderr in the archive will end with the line “”.

Running go test -update will rewrite the stdout and stderr files in each testdata archive to match the current state of the tool. This is a useful command when the logging prints from bisect change or when writing a new test.

To use go test -update to write a new test:

  • Create a new .txt file with just a JSON object at the top, specifying what you want to test.
  • Run go test -update.
  • Reload the .txt file and read the stdout and stderr to see if you agree.