testutil

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendTestData

func AppendTestData(name string) (f *os.File, isNew bool)

AppendTestData adds to an existing file found in the ./testdata directory. If file is not found it will be created

func Assert

func Assert(tb testing.TB, condition bool, msg string, v ...interface{})

Assert fails the test if the condition is false.

func Equals

func Equals(tb testing.TB, exp, act interface{})

Equals fails the test if exp is not equal to act.

func LoadEnvVar

func LoadEnvVar(envPath string)

LoadEnvVar loads a .env file into OS

func LoadTestData

func LoadTestData(name string) []byte

LoadTestData loads a file from ./testdata.

func MakeFunctionRunOnRootFolder

func MakeFunctionRunOnRootFolder()

MakeFunctionRunOnRootFolder is a helper to change the working direcory to project root

func OK

func OK(tb testing.TB, err error)

OK fails the test if an err is not nil.

func SaveTestData

func SaveTestData(name, ext string, makeUnique bool) *os.File

SaveTestData creates a unique file in ./testdata by adding a compact GUID to the file name

func TrackTime

func TrackTime(what string, start time.Time)

TrackTime is intended to be used with defer to measure exexution time.

func Truncate

func Truncate(s string, count int) string

Truncate a string to a given length and add ellipsis to denote truncation

Types

This section is empty.

Jump to

Keyboard shortcuts

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