testutil

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(data []byte) string

BytesToString convert a byte slice into its string representation. Each byte is represented as a 2 upper-case letters for A-F

func LocatePackageFiles

func LocatePackageFiles(path string) ([]string, error)

LocatePackageFiles returns a slice of all the buildable source files in the given directory

func RunTestAppAsync

func RunTestAppAsync(args []string, killChan <-chan bool) <-chan TestAppResult

RunTestAppAsync starts a go program via 'go run' and returns immediately. To kill the process, send to killChan. To wait for the program to finish, receive on TestAppResult chan.

func StringToBytes

func StringToBytes(input string) ([]byte, error)

StringToBytes takes an input string in a 2-hex-symbol per byte format and returns corresponding byte array. Input must not contain any symbols except [A-F0-9]

func WaitForFunc

func WaitForFunc(f func(), d time.Duration) bool

WaitForFunc calls f asynchronously leaving it some time to finish. It returns true, if f completed.

Types

type TestAppResult

type TestAppResult struct {
	Output string
	Err    error
}

TestAppResult is a result of a 'go run' program launch

func RunApp

func RunApp(command string, args []string, killChan <-chan bool) (result TestAppResult)

RunApp starts a go program. To kill the process, send to killChan

func RunTestApp

func RunTestApp(args []string, killChan <-chan bool) (result TestAppResult)

RunTestApp starts a go program via 'go run'. To kill the process, send to killChan

func WaitForAppResultChan

func WaitForAppResultChan(ch <-chan TestAppResult, d time.Duration) (TestAppResult, bool)

WaitForAppResultChan waits for a value from ch with a timeout

Jump to

Keyboard shortcuts

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