Documentation
¶
Overview ¶
Package dump lays out the data an action returned, such as the request and the response of a step, as YAML-like lines to be read by a person:
headers: Accept: */* method: GET url: https://example.com/
It is meant for reading, not for parsing back:
- The keys of a map are sorted, so the same data is always laid out the same way.
- A string of several lines is written under its key, as a YAML block, and each of its lines is indented there. So is a line that ends in a newline, as a body often does, so that its quotes are not escaped.
- A string of one line is quoted, as Go quotes it, when it could be read as something else: when it is empty, looks like a number, true, false or null, has a space at either end, or holds a control character, such as a newline that is all it holds. A control character is never written as it is, in a key either, so that it cannot move the cursor of a terminal.
- A block is written after |, as YAML writes it, when the string ends in a newline, and after |- when it does not.
- A string that is not UTF-8, or a []byte, is not written at all, only how many bytes it holds, as binary data is no use on a terminal.
Options can cut what is long, and say how much was cut, so that a large response body cannot bury what it is shown with.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// MaxBytes is how many bytes of a string are shown, or 0 for all of them.
MaxBytes int
// MaxLines is how many lines of a string are shown, or 0 for all of them.
MaxLines int
// MaxItems is how many entries of a map or a list are shown, or 0 for all
// of them.
MaxItems int
// OmitEmpty leaves out the entries of the map given to Lines whose value
// is nil, an empty string or an empty map or list, such as the empty
// fields every action fills in. A zero or a false is kept, as it is a
// value a test may have read. The maps nested in it are laid out whole:
// what they hold is the data, such as a body or a row, empty values and
// all.
OmitEmpty bool
}
Options say what is cut and left out. The zero value lays out everything.