Documentation ¶
Overview ¶
Package test provides utility methods and classes for testing.
Index ¶
Constants ¶
const (
// ShouldNeverHappen is only seen when the impossible happens.
ShouldNeverHappen = "http://www.nooooooooooooooo.com"
)
Variables ¶
This section is empty.
Functions ¶
func ChangeToTestDir ¶
ChangeToTestDir creates a new test directory and changes the current directory to be
func RandomData ¶
RandomData returns a slice of a given size filled with random data
Types ¶
type TestError ¶
TestError is an error that stores a uniquely generated id
func NewTestError ¶
func NewTestError() *TestError
NewTestError creates a TestError with a newly created id
type TestReader ¶
type TestReader struct {
// contains filtered or unexported fields
}
TestReader is an io.Reader that will error after some number of bytes have been read
func NewTestReader ¶
func NewTestReader(dataSize, errorAfter int) *TestReader
NewTestReader takes a size, and the number of bytes that should be read before the reader errors. The size is used to generate a buffer of random data that will be read by the caller. After the caller has read the specified number of bytes the call to read will fail.
func NewTestReaderWithData ¶
func NewTestReaderWithData(data []byte, errorAfter int) *TestReader
NewTestReaderWithData creates a TestReader with user supplied data and the number of bytes that can be read before errors start occurring on Read calls.