Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockReadCloser ¶
type MockReadCloser struct {
// contains filtered or unexported fields
}
MockReadCloser implements reading from a predefined byte slice and tracks closed state for testing.
func NewMockReadCloser ¶
func NewMockReadCloser(t *testing.T, data []byte) *MockReadCloser
NewMockReadCloser constructs a ReadCloser bound to the given test and byte slice.
func (*MockReadCloser) Close ¶
func (mrc *MockReadCloser) Close() error
Close tracks closed state and returns nil.
func (*MockReadCloser) IsClosed ¶
func (mrc *MockReadCloser) IsClosed() bool
IsClosed allows test code to query whether or not a MockReadCloser has been closed.
type MockWriteCloser ¶
type MockWriteCloser struct {
// contains filtered or unexported fields
}
MockWriteCloser tracks write+close state for testing purposes.
func NewMockWriteCloser ¶
func NewMockWriteCloser(t *testing.T) *MockWriteCloser
NewMockWriteCloser constructs a MockWriteCloser for a given test.
func (*MockWriteCloser) Close ¶
func (mwc *MockWriteCloser) Close() error
Close stores "closed" state and synchronizes by sending true to MockWriteCloser.c iff it is not nil. Note that the synchronization message is sent from this goroutine; i.e., Close() will not return until another goroutine receives the message.