Documentation ¶
Overview ¶
Package iosemantic contains helper functions to verify that io.Readers, io.Writers and other io interfaces adhere to the given specifications.
Index ¶
- func ImplementsReader(t *testing.T, reader io.Reader) bool
- func ImplementsReaderAt(t *testing.T, reader io.ReaderAt, length int64) bool
- func ImplementsReaderAtOpts(t *testing.T, reader io.ReaderAt, length int64, opts ReaderAtOpts) bool
- func ImplementsReaderFrom(t *testing.T, reader io.ReaderFrom) bool
- func ImplementsReaderFromOpts(t *testing.T, reader io.ReaderFrom, opts ReaderFromOpts) bool
- func ImplementsReaderOpts(t *testing.T, reader io.Reader, opts ReaderOpts) bool
- func ImplementsWriter(t *testing.T, writer io.Writer) bool
- func ImplementsWriterAt(t *testing.T, writer io.WriterAt, length int64) bool
- func ImplementsWriterAtOpts(t *testing.T, writer io.WriterAt, length int64, opts WriterAtOpts) bool
- func ImplementsWriterOpts(t *testing.T, writer io.Writer, opts WriterOpts) bool
- func ImplementsWriterTo(t *testing.T, writer io.WriterTo) bool
- func ImplementsWriterToOpts(t *testing.T, writer io.WriterTo, opts WriterToOpts) bool
- type ReaderAtOpts
- type ReaderFromOpts
- type ReaderOpts
- type WriterAtOpts
- type WriterOpts
- type WriterToOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImplementsReader ¶
ImplementsReader verifies the following properties for a reader:
- n <= len(p) (where p is the buffer passed to the Read method).
- if 0 < n < len(p), an error is returned; or the next call to read returns 0, io.EOF
- if len(p) == 0, n == 0
Use ImplementsReaderOpts for more control over the test suite.
func ImplementsReaderAt ¶
ImplementsReaderAt verifies the following properties for a io.ReaderAt:
1. n <= len(p) (where p is the buffer passed to the Read method). 2. if 0 < n < len(p), an error is returned; 3. if len(p) == 0, n == 0 4. Parallel ReadAt calls do not result in errors.
ImplementsReaderAt is a more strict version of ImplementsReader, just like the semantics of io.Reader and io.ReaderAt. Use ImplementsReaderAtOpts for more control over the test suite.
func ImplementsReaderAtOpts ¶
ImplementsReaderAtOpts uses providing options to perform ImplementsReaderAt.
func ImplementsReaderFrom ¶
func ImplementsReaderFrom(t *testing.T, reader io.ReaderFrom) bool
ImplementsReaderFrom verifies the following properties for a reader:
1. The ReaderFrom consumes the input until an error is encountered. 2. io.EOF is not returned.
Use ImplementsReaderFromOpts for more control over the test suite.
func ImplementsReaderFromOpts ¶
func ImplementsReaderFromOpts(t *testing.T, reader io.ReaderFrom, opts ReaderFromOpts) bool
ImplementsReaderFromOpts uses providing options to perform ImplementsReaderFrom.
func ImplementsReaderOpts ¶
ImplementsReaderOpts uses providing options to perform ImplementsReader.
func ImplementsWriter ¶
ImplementsWriter verifies the following properties for a writer:
1. 0 <= n <= len(p) where p is the buffer being written from. 2. if n < len(p), err != nil.
Use ImplementsWriterOpts for more control over the test suite.
func ImplementsWriterAt ¶
ImplementsWriterAt verifies the following properties for a writer:
1. 0 <= n <= len(p) where p is the buffer being written from. 2. if n < len(p), err != nil. 3. No error is returned during parallel WriteAt calls on the same destination if the ranges do not overlap.
Use ImplementsWriterAtOpts for more control over the test suite.
func ImplementsWriterAtOpts ¶
ImplementsWriterAtOpts uses providing options to perform ImplementsWriterAt.
func ImplementsWriterOpts ¶
ImplementsWriterOpts uses providing options to perform ImplementsWriter.
func ImplementsWriterTo ¶
ImplementsWriterTo verifies the following properties for a reader:
1. The WriterTo writes to the writer until it is finished, or an error is encountered. 2. Any error is returned.
Use ImplementsWriterToOpts for more control over the test suite.
func ImplementsWriterToOpts ¶
ImplementsWriterToOpts uses providing options to perform ImplementsWriterTo.
Types ¶
type ReaderAtOpts ¶
type ReaderAtOpts struct {
BufferSize int
}
ReaderAtOpts defines fine tunes controls for the ImplementsReaderAtOpts test.
type ReaderFromOpts ¶
type ReaderFromOpts struct {
BufferSize int
}
ReaderFromOpts defines fine tunes controls for the ImplementsReaderFromOpts test.
type ReaderOpts ¶
type ReaderOpts struct {
BufferSize int
}
ReaderOpts defines fine tunes controls for the ImplementsReaderOpts test.
type WriterAtOpts ¶
type WriterAtOpts struct {
BufferSize int
}
WriterAtOpts defines fine tunes controls for the ImplementsWriterAtOpts test.
type WriterOpts ¶
type WriterOpts struct {
BufferSize int
}
WriterOpts defines fine tunes controls for the ImplementsWriterOpts test.
type WriterToOpts ¶
type WriterToOpts struct {
BufferSize int
}
WriterToOpts defines fine tunes controls for the ImplementsWriterToOpts test.