Documentation ¶
Overview ¶
Package tst provides some helper functions for testing.
Index ¶
- func AssertNoErr(tb testing.TB, err error)
- func AssertTrue(tb testing.TB, flag bool)
- func AssertTrueElseInfo(tb testing.TB, flag bool, info string)
- func CaptureStdOut(f func()) string
- func Equal(tb testing.TB, exp, act interface{})
- func EqualFiles(t *testing.T, fn0, fn1 string)
- func EqualLines(tb testing.TB, exp, act string)
- func EqualStrings(t *testing.T, exp, act string)
- func EqualTextFiles(t *testing.T, fn0, fn1 string)
- func TempFileName(pattern string) (s string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNoErr ¶
AssertNoErr fails the test if err is not nil.
func AssertTrue ¶
AssertTrue fails the test if flag is false.
func AssertTrueElseInfo ¶
AssertTrueElseInfo fails the test if flag is false.
func CaptureStdOut ¶
func CaptureStdOut(f func()) string
CaptureStdOut captures stdout and returns it as string.
func EqualFiles ¶
EqualFiles fails test if contence is NOT equal
func EqualLines ¶
EqualLines compares exp and act line by line ignoring lineendings and leading/trailing spaces.
func EqualStrings ¶
EqualStrings fails test if strings not identical.
func EqualTextFiles ¶
EqualTextFiles fails test if lines in fn0 & fn1 NOT equal. Line endings are ignored
func TempFileName ¶
TempFileName returns a temporary file name based on pattern. The file is created and deleted and only the name is delivered. The pattern should contain at least an asterics. Example: myFile-*.bin"
Types ¶
This section is empty.