Documentation
¶
Overview ¶
Package cmdtest provides tools for testing command line tools.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LeakCheck ¶
LeakCheck tests for output being leaked to os.Stdout and os.Stderr that should be sent elsewhere (e.g., the stdout and stderr streams passed to a cmd.RunFunc).
It redirects os.Stdout and os.Stderr to a tempfile, and returns a func, which the caller is expected to defer, that restores os.* and checks that the tempfile is empty.
Example:
func (s *Suite) TestSomething(c *check.C) {
defer cmdtest.LeakCheck(c)()
// ... do things that shouldn't print to os.Stderr or os.Stdout
}
Types ¶
This section is empty.
Source Files
¶
- leakcheck.go
Click to show internal directories.
Click to hide internal directories.