tst

package
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package tst provides some helper functions for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertNoErr

func AssertNoErr(tb testing.TB, err error)

AssertNoErr fails the test if err is not nil.

func AssertTrue

func AssertTrue(tb testing.TB, flag bool)

AssertTrue fails the test if flag is false.

func AssertTrueElseInfo

func AssertTrueElseInfo(tb testing.TB, flag bool, info string)

AssertTrueElseInfo fails the test if flag is false.

func CaptureStdOut

func CaptureStdOut(f func()) string

CaptureStdOut captures stdout and returns it as string.

func Equal

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

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

func EqualFiles

func EqualFiles(t *testing.T, fn0, fn1 string)

EqualFiles fails test if contence is NOT equal

func EqualLines

func EqualLines(tb testing.TB, exp, act string)

EqualLines compares exp and act line by line ignoring lineendings and leading/trailing spaces.

func EqualStrings

func EqualStrings(t *testing.T, exp, act string)

EqualStrings fails test if strings not identical.

func EqualTextFiles

func EqualTextFiles(t *testing.T, fn0, fn1 string)

EqualTextFiles fails test if lines in fn0 & fn1 NOT equal. Line endings are ignored

func TempFileName

func TempFileName(pattern string) (s string)

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.

Jump to

Keyboard shortcuts

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