Documentation ¶
Index ¶
- Constants
- func Assert(tb TB, condition bool, format string, a ...interface{})
- func Equals(tb TB, exp, act interface{})
- func ErrorEqual(left, right error) bool
- func NewRoundTripCheckRequest(checkRequest func(*http.Request), theResponse *http.Response, theError error) http.RoundTripper
- func NewStorage(t T) storage.Storage
- func NotOk(tb TB, err error, format string, a ...interface{})
- func Ok(tb TB, err error)
- type Closer
- type MockContext
- type T
- type TB
- type TemporaryDirectory
Constants ¶
const ( // NilCloser is a no-op Closer. NilCloser = nilCloser(true) )
Variables ¶
This section is empty.
Functions ¶
func Equals ¶
func Equals(tb TB, exp, act interface{})
Equals fails the test if exp is not equal to act.
func ErrorEqual ¶
ErrorEqual compares Go errors for equality.
func NewRoundTripCheckRequest ¶
func NewRoundTripCheckRequest(checkRequest func(*http.Request), theResponse *http.Response, theError error) http.RoundTripper
NewRoundTripCheckRequest creates a new instance of a type that implements http.RoundTripper, which before returning theResponse and theError, executes checkRequest against a http.Request.
func NewStorage ¶
NewStorage returns a new storage for testing purposes that removes all associated files on closing.
Types ¶
type Closer ¶
type Closer interface { // Close reaps the underlying directory and its children. The directory // could be deleted by its users already. Close() }
Closer is the interface that wraps the Close method.
func NewCallbackCloser ¶
func NewCallbackCloser(fn func()) Closer
NewCallbackCloser returns a Closer that calls the provided function upon closing.
type MockContext ¶
type MockContext struct { Error error DoneCh chan struct{} }
A MockContext provides a simple stub implementation of a Context
func (*MockContext) Deadline ¶
func (c *MockContext) Deadline() (deadline time.Time, ok bool)
Deadline always will return not set
func (*MockContext) Done ¶
func (c *MockContext) Done() <-chan struct{}
Done returns a read channel for listening to the Done event
func (*MockContext) Err ¶
func (c *MockContext) Err() error
Err returns the error, is nil if not set.
func (*MockContext) Value ¶
func (c *MockContext) Value(key interface{}) interface{}
Value ignores the Value and always returns nil
type T ¶
type T interface { Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) }
T implements the needed methods of testing.TB so that we do not need to actually import testing (which has the side effect of adding all the test flags, which we do not want in non-test binaries even if they make use of these utilities for some reason).
type TB ¶
type TB interface { Helper() Fatalf(string, ...interface{}) }
This package is imported by non-test code and therefore cannot import the testing package, which has side effects such as adding flags. Hence we use an interface to testing.{T,B}.
type TemporaryDirectory ¶
type TemporaryDirectory interface { Closer // Path returns the underlying path for access. Path() string }
TemporaryDirectory models a closeable path for transient POSIX disk activities.
func NewTemporaryDirectory ¶
func NewTemporaryDirectory(name string, t T) (handler TemporaryDirectory)
NewTemporaryDirectory creates a new temporary directory for transient POSIX activities.