testlib

package module
v0.0.0-...-24e711f Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2018 License: MIT Imports: 8 Imported by: 0

README

testlib

Documentation Build Status Report Card

About

Go (golang) library which provides extended testing helpers and utilities.

Created by Jay Taylor and used by Gigawatt.

Requirements
  • Go version 1.3 or newer
Running the test suite
go test ./...
License

Permissive MIT license, see the LICENSE file for more information.

Documentation

Index

Constants

View Source
const (
	SkipUnlessOSIllegalInvocation = "SkipUnlessOS invoked with empty `allowedOss' array"
)

Variables

This section is empty.

Functions

func CurrentRunningTest

func CurrentRunningTest() string

CurrentRunningTest obtains the name of the currently running unit test. Use this with care, if invoked from an `init()` function, it WILL panic.

For example, given the following Stack:

apiserver_test.go:74: ok
apiserver_test.go:69: 424
apiserver_test.go:70: goroutine 7 [running]:
	gigawatt-common/apiserver.tj(0xc208058090)
		/Users/jay/go/src/gigawatt-common/apiserver/apiserver_test.go:69 +0x7a
	gigawatt-common/apiserver.Test_Jay(0xc208058090)
		/Users/jay/go/src/gigawatt-common/apiserver/apiserver_test.go:75 +0xf9
	testing.tRunner(0xc208058090, 0x6de870)
		/usr/local/go/src/testing/testing.go:447 +0xbf
	created by testing.RunTests
		/usr/local/go/src/testing/testing.go:555 +0xa8b

CurrentRunningTest() will return the string "Test_Jay".

func FullFunctionName

func FullFunctionName(i interface{}) string

func FunctionName

func FunctionName(i interface{}) string

func IsRunningTests

func IsRunningTests() bool

IsRunningTests returns true if a unit-test is being run right now.

func SkipUnlessOS

func SkipUnlessOS(t *testing.T, allowedOSs ...string)

SkipUnlessOS is a common facility for skipping a test when the OS doesn't match one or more values.

func Stack

func Stack() []byte

Stack attempts to safely ensure that the entire Stack is captured.

func WaitUntil

func WaitUntil(what string, waitTimeout time.Duration, fn func() bool, pause ...time.Duration) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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