testhelpers

package
v0.0.0-...-4655df8 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(t *testing.T) string

Action yields "action". Srsly, wtf?

func ChdirTemp

func ChdirTemp(t *testing.T) func()

ChdirTemp changes the working directory to a new TempDir. The cleanup function returns to the previous working directoy and removes the temp directory.

func CopyFile

func CopyFile(t *testing.T, src string, dest string, mode os.FileMode)

CopyFile copies data from one file another. If the target file does not exist then it will be created with the given mode. This is a non-optimal copy and not intended to be used for very large files.

func CorruptFile

func CorruptFile(t *testing.T, path string)

CorruptFile writes an string to the beginning of the file.

func Fill

func Fill(t *testing.T, fp io.Writer, size int64)

Fill writes size amount of bytes to the file.

func TempCopy

func TempCopy(t *testing.T, src string, mode os.FileMode) (string, func())

TempCopy copies provided file to a new temp file that will be assigned the provided mode after the copy. (So the mode can specify a read-only file.)

func TempDir

func TempDir(t *testing.T) (string, func())

TempDir returns path to a new temporary directory and function that will forcibly remove it.

func TempFile

func TempFile(t *testing.T, size int64) (string, func())

TempFile creates a temporary file. If size is >0 then that amount of bytes will be written to the file.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL