assert

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

assert

Minimalistic replacement for https://pkg.go.dev/github.com/stretchr/testify/assert

Documentation

Overview

Minimalistic drop in eplacement for github.com/stretchr/testify/assert

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert added in v1.1.0

func Assert(t *testing.T, cond bool, msg string, rest ...interface{})

Assert is similar to True() under a different name and earlier fortio/stats test implementation.

func CheckEquals added in v1.1.0

func CheckEquals(t *testing.T, actual interface{}, expected interface{}, msg interface{})

CheckEquals checks if actual == expect and fails the test and logs failure (including filename:linenum if they are not equal).

func Contains

func Contains(t *testing.T, haystack, needle string, msg ...string)

Contains checks that needle is in haystack.

func Equal

func Equal(t *testing.T, a, b interface{}, msg ...string)

Equal also checks for a equal b.

func EqualValues

func EqualValues(t *testing.T, a, b interface{}, msg ...string)

EqualValues checks for a equal b.

func Error

func Error(t *testing.T, err error, msg ...string)

Error checks/expects an error.

func Errorf

func Errorf(t *testing.T, format string, rest ...interface{})

Errorf is a local variant to get the right line numbers.

func Fail

func Fail(t *testing.T, msg string)

Fail fails the test.

func False

func False(t *testing.T, b bool, msg ...string)

False checks bool is false.

func NoError

func NoError(t *testing.T, err error, msg ...string)

NoError checks for no errors (nil).

func NotEqual

func NotEqual(t *testing.T, a, b interface{}, msg ...string)

NotEqual checks for a not equal b.

func ObjectsAreEqualValues

func ObjectsAreEqualValues(a, b interface{}) bool

ObjectsAreEqualValues returns true if a == b (through refection).

func Run

func Run(t *testing.T, suite hasT)

Run runs the test suite with SetupTest first and TearDownTest after. replaces https://pkg.go.dev/github.com/stretchr/testify/suite#Run

func True

func True(t *testing.T, b bool, msg ...string)

True checks bool is true.

Types

type TestSuite

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

TestSuite to be used as base struct for test suites. replaces https://pkg.go.dev/github.com/stretchr/testify@v1.8.0/suite

func (*TestSuite) SetT

func (s *TestSuite) SetT(t *testing.T)

SetT sets the testing.T in the suite object.

func (*TestSuite) T

func (s *TestSuite) T() *testing.T

T returns the current testing.T.

Jump to

Keyboard shortcuts

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