assert

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package assert provides tiny asserting functions for testing. Inspired by github.com/stretchr/testify/assert and https://github.com/benbjohnson/testing

Index

Constants

This section is empty.

Variables

New is a func alias for NewAssert. The name NewAssert is reduncdant but kept for compatibility.

Functions

func IsNil

func IsNil(object interface{}) bool

IsNil checks an interface{} with the reflect package.

func ObjectsAreEqual

func ObjectsAreEqual(expected, actual interface{}) bool

ObjectsAreEqual checks two interfaces with reflect.DeepEqual.

Types

type Assert

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

Assert wraps a testing.TB for convenient asserting calls.

func NewAssert

func NewAssert(t testing.TB) *Assert

NewAssert provides an Assert instance.

func (*Assert) Equal

func (a *Assert) Equal(expected, actual interface{}, msg string)

Equal tests if the two interfaces provided is equal and prints the msg for failure.

func (*Assert) NoError

func (a *Assert) NoError(err error, msg string)

NoError fails the test and prints the msg if err != nil.

func (*Assert) NotNil

func (a *Assert) NotNil(obj interface{}, msg string)

NotNil fails the test and prints the msg if the obj is nil.

func (*Assert) True

func (a *Assert) True(cond bool, msg string)

True tests if the cond is true and prints the msg for failure.

Jump to

Keyboard shortcuts

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