assert

package module
v0.0.0-...-1a11905 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: MIT Imports: 3 Imported by: 1

README

assert

GoDoc Go Report Card

A simple assertion framework for Go.

Read online reference at http://godoc.org/bitbucket.org/vinothkumarj/brandingdeb/assert

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equals

func Equals(t Tester, expected, actual interface{}, msg ...interface{}) bool

Equals checks that expected and actual are equal.

func Error

func Error(t Tester, err error, msg ...interface{}) bool

Error checks if err is not nil.

func False

func False(t Tester, condition bool, msg ...interface{}) bool

False checks that a condition is false.

func Fatal

func Fatal(t Tester, condition bool, msg ...interface{})

Fatal checks that a condition is true or marks the test as failed and stop it's execution.

func FatalError

func FatalError(t Tester, err error, msg ...interface{})

FatalError checks that a error is nil or marks the test as failed and stop it's execution.

func HasPrefix

func HasPrefix(t Tester, s, p string, msg ...interface{}) bool

HasPrefix checks that the string contains the given prefix.

func HasSuffix

func HasSuffix(t Tester, s, suffix string, msg ...interface{}) bool

HasSuffix checks that the string ends with the given suffix.

func Len

func Len(t Tester, expected int, value interface{}, msg ...interface{}) bool

Len checks that the application of len() to value match the expected value.

func Nil

func Nil(t Tester, value interface{}, msg ...interface{}) bool

Nil checks that the value is nil.

func NoError

func NoError(t Tester, err error, msg ...interface{}) bool

NoError checks if err nil.

func NotEquals

func NotEquals(t Tester, expected, actual interface{}, msg ...interface{}) bool

NotEquals checks that expected and actual are not equal.

func NotNil

func NotNil(t Tester, value interface{}, msg ...interface{}) bool

NotNil checks that the value is not nil.

func Panic

func Panic(t Tester, f func(), msg ...interface{}) (ret bool)

Panic checks that the passed function panics.

func True

func True(t Tester, condition bool, msg ...interface{}) bool

True checks that a condition is true.

func Type

func Type(t Tester, expected, value interface{}, msg ...interface{}) bool

Type checks that the value matches the type of expected.

Types

type Tester

type Tester interface {
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Helper()
}

Tester is an interface that testing.T implements, It has the methods used in the implementation of this package.

Jump to

Keyboard shortcuts

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