Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var EOFChan = make(chan interface{})
EOFChan can be closed to simulate reading the end of a file. The MockLine value will be returned with simulated end-of-file behavior.
var MockLine = []byte("mock line\n")
MockLine can be used for setting the return value of a call to Read() or ReadLine(). The set value will be returned unless Reader is initialized with a MockReader value that indicates returning an error.
var MsgChan = make(chan []byte)
MsgChan can be used to set a read message value. The call to Read or ReadLine will block until a mock message is send on MsgChan. This way both the value and timing of a read call can be controlled. This can be useful when testing.
The reader only listens on MsgChan if len(MockLine) is 0.
If EOFChan is closed then and a message is written to MsgChan the reader may behave as if it reached an end-of-file or it may return the MsgChan message. If it is desired to return a message with end-of-file behavior then make sure MockLine is set with the desired return value.
Functions ¶
Types ¶
type Reader ¶
type Reader struct {
MockReadMode string
// contains filtered or unexported fields
}