Пример #1
0
func Example() {

	buffer := unittest.SetupBuffer( // Setup
	)
	defer buffer.DumpToStdout()

	// Unit tests go here.

	// Clear the buffer so nothing ends up being printed.
	buffer.Clear()
}
Пример #2
0
func ExamplePass() {
	// Setup
	buffer := unittest.SetupBuffer()
	defer buffer.DumpToStdout()

	// Log a bunch of stuff.
	logger := logray.New()
	fmt.Println("Expected output.")
	logger.Info("log line 1")
	logger.Info("log line 2")
	logger.Info("log line 3")

	// Clear the buffer so nothing ends up on stdout.
	buffer.Clear()

	// Output: Expected output.
}