Documentation ¶
Overview ¶
Package capture assists in testing code writing output to stdout or stderr. Those will be temporarily exchanged so that the written output will be caught and can be retrieved.
cout := capture.Stdout(func() { fmt.Printf("Hello, World!") }) cerr := capture.Stderr(func() { ... }) assert.Equal(cout.String(), "Hello, World!") cout, cerr = capture.Both(func() { ... })
The captured content data also can be retrieved as bytes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.