testing

package
v0.0.0-...-1b45c92 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package testing provides some convenience functionality for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(condition bool, message string, t *T, arg ...interface{})

Assert tests a condition occuring during a test t for being true. If it is true, it will format-print message with the arguments given in arg. Otherwise it will add an error to t containing the same format- printed message.

Types

type T

type T struct {
	// contains filtered or unexported fields
}

T is a wrapper for testing.T, providing assertion functions.

func NewT

func NewT(t *testing.T) *T

NewT creates a new instance of T, which wraps t.

func NewVerboseT

func NewVerboseT(t *testing.T) *T

NewVerboseT creates a new verbose instance of T, which wraps t. A verbose T will also print messages when assertions hold.

func (*T) Assert

func (t *T) Assert(condition bool, message string, arg ...interface{})

Assert performs Assert(...) on the testing.T wrapped by t.

func (*T) AssertEquals

func (t *T) AssertEquals(expected interface{}, actual interface{}, message string, arg ...interface{})

AssertEquals compares v1 and v2 and performs Assert(...) on the testing.T wrapped by t with the result of this comparison.

func (*T) AssertError

func (t *T) AssertError(err error, message string, arg ...interface{})

AssertError performs Assert(...) on the testing.T wrapped by t, testing err for not being nil.

func (*T) AssertNoError

func (t *T) AssertNoError(err error, message string, arg ...interface{})

AssertNoError performs Assert(...) on the testing.T wrapped by t, testing err for being nil.

Jump to

Keyboard shortcuts

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