Documentation
¶
Index ¶
- type Consumer
- type Expectations
- type Fault
- func (f *Fault) Bytes() expect.Expectation
- func (f *Fault) BytesAt(pos int64, bytes int) expect.Expectation
- func (f *Fault) Close() error
- func (f *Fault) ContentType() expect.Expectation
- func (f *Fault) Lines() expect.Expectation
- func (f *Fault) NextBytes(bytes int) expect.Expectation
- func (f *Fault) NextLine() expect.Expectation
- func (f *Fault) NextText(bytes int) expect.Expectation
- func (f *Fault) Size() expect.Expectation
- func (f *Fault) Text() expect.Expectation
- func (f *Fault) TextAt(pos int64, bytes int) expect.Expectation
- type File
- func (f *File) Bytes() expect.Expectation
- func (f *File) BytesAt(pos int64, bytes int) expect.Expectation
- func (f *File) Close() error
- func (f *File) ContentType() expect.Expectation
- func (f *File) Lines() expect.Expectation
- func (f *File) NextBytes(bytes int) expect.Expectation
- func (f *File) NextLine() expect.Expectation
- func (f *File) NextText(bytes int) expect.Expectation
- func (f *File) Size() expect.Expectation
- func (f *File) Text() expect.Expectation
- func (f *File) TextAt(pos int64, bytes int) expect.Expectation
- type Writable
- func (w *Writable) Bytes() expect.Expectation
- func (w *Writable) BytesAt(pos int64, bytes int) expect.Expectation
- func (w *Writable) Close() error
- func (w *Writable) ContentType() expect.Expectation
- func (w *Writable) Lines() expect.Expectation
- func (w *Writable) NextBytes(bytes int) expect.Expectation
- func (w *Writable) NextLine() expect.Expectation
- func (w *Writable) NextText(bytes int) expect.Expectation
- func (w *Writable) Size() expect.Expectation
- func (w *Writable) Text() expect.Expectation
- func (w *Writable) TextAt(pos int64, bytes int) expect.Expectation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expectations ¶ added in v0.0.3
type Expectations interface {
// Close frees up resources
Close() error
// Size returns an Expectation about the size of the data in bytes
Size() expect.Expectation
// Text returns an Expectation about the data as utf-8 text
Text() expect.Expectation
// NextText returns an Expectation about the next chunk of text
NextText(bytes int) expect.Expectation
// TextAt returns an Expectation about text starting at the given byte offset
TextAt(pos int64, bytes int) expect.Expectation
// Bytes returns an Expectation about the data as a byte array
Bytes() expect.Expectation
// NextBytes returns an Expectation about the next chunk of bytes
NextBytes(bytes int) expect.Expectation
// BytesAt returns an Expectation about the bytes starting at the given offset
BytesAt(pos int64, bytes int) expect.Expectation
// Lines returns an Expectation about the data as lines of text
Lines() expect.Expectation
// NextLine returns an Expectation about the next line of text
NextLine() expect.Expectation
// ContentType returns an Expectation about the media type.
// See https://en.wikipedia.org/wiki/Media_type
ContentType() expect.Expectation
}
Expectations is a set of expectations about a data stream
func ExpectFile ¶ added in v0.0.3
func ExpectFile(t *testing.T, file *os.File) Expectations
ExpectFile returns expectations based on a file descriptor
func ExpectWritten ¶ added in v0.0.3
func ExpectWritten(t *testing.T, consumer Consumer) Expectations
ExpectWritten returns expectations based on a function that writes to a stream
type Fault ¶
Fault is a set of stream expectations that always result in an error
func (*Fault) BytesAt ¶
func (f *Fault) BytesAt(pos int64, bytes int) expect.Expectation
BytesAt returns a faulty Expectation
func (*Fault) ContentType ¶
func (f *Fault) ContentType() expect.Expectation
ContentType returns a faulty Expectation
func (*Fault) Lines ¶ added in v0.0.2
func (f *Fault) Lines() expect.Expectation
Lines returns a faulty Expectation
func (*Fault) NextBytes ¶
func (f *Fault) NextBytes(bytes int) expect.Expectation
NextBytes returns a faulty Expectation
func (*Fault) NextLine ¶ added in v0.0.2
func (f *Fault) NextLine() expect.Expectation
NextLine returns a faulty Expectation
type File ¶
File is a set of expectations about a file stream
func (*File) Bytes ¶
func (f *File) Bytes() expect.Expectation
Bytes returns an Expectation about the entire file contents
func (*File) BytesAt ¶
func (f *File) BytesAt(pos int64, bytes int) expect.Expectation
BytesAt returns an Expectation about the file contents at a specific position
func (*File) ContentType ¶
func (f *File) ContentType() expect.Expectation
ContentType returns an Expectation about the content type
func (*File) Lines ¶ added in v0.0.2
func (f *File) Lines() expect.Expectation
Lines returns an Expectation about the entire file contents as lines of text
func (*File) NextBytes ¶
func (f *File) NextBytes(bytes int) expect.Expectation
NextBytes returns an Expectation about the next chunk of bytes
func (*File) NextLine ¶ added in v0.0.2
func (f *File) NextLine() expect.Expectation
NextLine returns an Expectation about the next line of text
func (*File) NextText ¶
func (f *File) NextText(bytes int) expect.Expectation
NextText returns an Expectation about the next chunk of text
func (*File) Size ¶
func (f *File) Size() expect.Expectation
Size returns an Expectation about the file size in bytes
func (*File) Text ¶
func (f *File) Text() expect.Expectation
Text returns an Expectation about the entire file contents as text
type Writable ¶
Writable is a set of expectations about a writable stream
func (*Writable) Bytes ¶
func (w *Writable) Bytes() expect.Expectation
Bytes returns an Expectation about all bytes written to the stream
func (*Writable) BytesAt ¶
func (w *Writable) BytesAt(pos int64, bytes int) expect.Expectation
BytesAt returns an Expectation about the bytes written at a specific position
func (*Writable) ContentType ¶
func (w *Writable) ContentType() expect.Expectation
ContentType returns an Expectation about content type written to the stream
func (*Writable) Lines ¶ added in v0.0.2
func (w *Writable) Lines() expect.Expectation
Lines returns an Expectation about all lines of text written to the stream
func (*Writable) NextBytes ¶
func (w *Writable) NextBytes(bytes int) expect.Expectation
NextBytes returns an Expectation about the next chunk of bytes written to the stream
func (*Writable) NextLine ¶ added in v0.0.2
func (w *Writable) NextLine() expect.Expectation
NextLine returns an Expectation about the next line of text
func (*Writable) NextText ¶
func (w *Writable) NextText(bytes int) expect.Expectation
NextText returns an Expectation about the next chunk of text written to the stream
func (*Writable) Size ¶
func (w *Writable) Size() expect.Expectation
Size returns an Expectation about the number of bytes written
func (*Writable) Text ¶
func (w *Writable) Text() expect.Expectation
Text returns an Expectation about all text written to the stream