Namespace: go.std.testing.iotest
v1.0Contents
Summary
Provides a low-level interface to the testing/iotest package.
Package iotest implements Readers and Writers useful mainly for testing.
Index
- DataErrReader
- ErrReader
- ErrTimeout
- HalfReader
- NewReadLogger
- NewWriteLogger
- OneByteReader
- TestReader
- TimeoutReader
- TruncateWriter
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
ErrTimeout
Var v1.0ErrTimeout is a fake timeout error.
Functions, Macros, and Special Forms
-
DataErrReader
Function v1.0(DataErrReader r)
DataErrReader changes the way errors are handled by a Reader. Normally, a
Reader returns an error (typically EOF) from the first Read call after the
last piece of data is read. DataErrReader wraps a Reader and changes its
behavior so the final error is returned along with the final data, instead
of in the first call after the final data.
Go input arguments: (r io.Reader)
Go returns: io.Reader
Joker input arguments: [^go.std.io/Reader r]
Joker returns: ^go.std.io/Reader -
ErrReader
Function v1.0(ErrReader err)
ErrReader returns an io.Reader that returns 0, err from all Read calls.
Go input arguments: (err error)
Go returns: io.Reader
Joker input arguments: [^Error err]
Joker returns: ^go.std.io/Reader -
HalfReader
Function v1.0(HalfReader r)
HalfReader returns a Reader that implements Read
by reading half as many requested bytes from r.
Go input arguments: (r io.Reader)
Go returns: io.Reader
Joker input arguments: [^go.std.io/Reader r]
Joker returns: ^go.std.io/Reader -
NewReadLogger
Function v1.0(NewReadLogger prefix r)
NewReadLogger returns a reader that behaves like r except
that it logs (using log.Printf) each read to standard error,
printing the prefix and the hexadecimal data read.
Go input arguments: (prefix string, r io.Reader)
Go returns: io.Reader
Joker input arguments: [^String prefix, ^go.std.io/Reader r]
Joker returns: ^go.std.io/Reader -
NewWriteLogger
Function v1.0(NewWriteLogger prefix w)
NewWriteLogger returns a writer that behaves like w except
that it logs (using log.Printf) each write to standard error,
printing the prefix and the hexadecimal data written.
Go input arguments: (prefix string, w io.Writer)
Go returns: io.Writer
Joker input arguments: [^String prefix, ^go.std.io/Writer w]
Joker returns: ^go.std.io/Writer -
OneByteReader
Function v1.0(OneByteReader r)
OneByteReader returns a Reader that implements
each non-empty Read by reading one byte from r.
Go input arguments: (r io.Reader)
Go returns: io.Reader
Joker input arguments: [^go.std.io/Reader r]
Joker returns: ^go.std.io/Reader -
TestReader
Function v1.0(TestReader r content)
TestReader tests that reading from r returns the expected file content.
It does reads of different sizes, until EOF.
If r implements io.ReaderAt or io.Seeker, TestReader also checks
that those operations behave as they should.
If TestReader finds any misbehaviors, it returns an error reporting them.
The error text may span multiple lines.
Go input arguments: (r io.Reader, content []byte)
Go returns: error
Joker input arguments: [^go.std.io/Reader r, ^arrayOfByte content]
Joker returns: ^Error -
TimeoutReader
Function v1.0(TimeoutReader r)
TimeoutReader returns ErrTimeout on the second read
with no data. Subsequent calls to read succeed.
Go input arguments: (r io.Reader)
Go returns: io.Reader
Joker input arguments: [^go.std.io/Reader r]
Joker returns: ^go.std.io/Reader -
TruncateWriter
Function v1.0(TruncateWriter w n)
TruncateWriter returns a Writer that writes to w
but stops silently after n bytes.
Go input arguments: (w io.Writer, n int64)
Go returns: io.Writer
Joker input arguments: [^go.std.io/Writer w, ^BigInt n]
Joker returns: ^go.std.io/Writer
Types
-
(None.)