testutil

package
Version: v0.0.0-...-95bd64c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// NilCloser is a no-op Closer.
	NilCloser = nilCloser(true)
)

Variables

This section is empty.

Functions

func ErrorEqual

func ErrorEqual(left, right error) bool

ErrorEqual compares Go errors for equality.

func NewCallbackCloser

func NewCallbackCloser(fn func()) *callbackCloser

NewCallbackCloser returns a Closer that calls the provided function upon 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.

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 affect 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 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL