assert

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func So added in v0.12.0

func So(actual any, assertion Assertion, expected ...any) error

So runs the provided Assertion and returns the error, as in: err := assert.So(1, should.Equal, 1)

Types

type Assertion

type Assertion func(actual any, expected ...any) error

type TestingT added in v0.12.0

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

TestingT is an intermediate type, not for direct instantiation.

func Error added in v0.12.0

func Error(t testingT) TestingT

Error receives a *testing.T, and prepares the caller for a So call. In the event of an assertion failure it will pass the error to *testing.T.Error. assert.Error(t).So(1, should.Equal, 2) // results in t.Error(err)

func Fatal added in v0.12.0

func Fatal(t testingT) TestingT

Fatal receives a *testing.T, and prepares the caller for a So call. In the event of an assertion failure it will pass the error to *testing.T.Fatal. assert.Fatal(t).So(1, should.Equal, 2) // results in t.Fatal(err)

func Log added in v0.12.0

func Log(t testingT) TestingT

Log receives a *testing.T, and prepares the caller for a So call. In the event of an assertion failure it will pass the error to *testing.T.Log. assert.Log(t).So(1, should.Equal, 2) // results in t.Log(err)

func Println added in v0.16.0

func Println() TestingT

Println prepares the caller for a So call. In the event of an assertion failure it will pass the error to fmt.Println. assert.Println().So(1, should.Equal, 2) // results in fmt.Println(err)

func (TestingT) So added in v0.12.0

func (this TestingT) So(actual any, assertion Assertion, expected ...any)

So runs the provided Assertion and calls the configured reporting function, as in: - assert.Println().So(1, should.Equal, 1) - assert.Log(t).So(1, should.Equal, 1) - assert.Error(t).So(1, should.Equal, 1) - assert.Fatal(t).So(1, should.Equal, 1)

Jump to

Keyboard shortcuts

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