testutil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TempDir

type TempDir string

TempDir represents a temporary directory which can easily be removed and is a bit more convenient that using ioutil.Tempdir when you are writing tests.

Typical usage:

func TestSomething(t *testing.T) {
    tmpDir := testutil.CreateTempDir(t)
    defer tmpDir.Remove(t)
    ...
    // use tmpDir.String() to get the name
}

func CreateTempDir

func CreateTempDir(t *testing.T) TempDir

CreateTempDir creates a temporary directory.

func (TempDir) Remove

func (tmp TempDir) Remove(t *testing.T)

Remove the temporary directory.

func (TempDir) String

func (tmp TempDir) String() string

type TempFile

type TempFile struct {
	File *os.File
}

TempFile is the log file

func CreateTempLogFile

func CreateTempLogFile(t *testing.T) TempFile

CreateTempLogFile creates a temp log File

func (TempFile) Remove

func (tmp TempFile) Remove(t *testing.T)

Remove the temporary File.

Jump to

Keyboard shortcuts

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