Documentation
¶
Index ¶
- func DeepEqual(t *testing.T, actual, expect any, message ...string) error
- func DeepEqualNow(t *testing.T, actual, expect any, message ...string) error
- func Nil(t *testing.T, val any, message ...string) error
- func NilNow(t *testing.T, val any, message ...string) error
- func NotDeepEqual(t *testing.T, actual, expect any, message ...string) error
- func NotDeepEqualNow(t *testing.T, actual, expect any, message ...string) error
- func NotNil(t *testing.T, val any, message ...string) error
- func NotNilNow(t *testing.T, val any, message ...string) error
- func NotPanic(t *testing.T, fn func(), message ...string) error
- func NotPanicNow(t *testing.T, fn func(), message ...string) error
- func NotTrue(t *testing.T, val any, message ...string) error
- func NotTrueNow(t *testing.T, val any, message ...string) error
- func Panic(t *testing.T, fn func(), message ...string) error
- func PanicNow(t *testing.T, fn func(), message ...string) error
- func True(t *testing.T, val any, message ...string) error
- func TrueNow(t *testing.T, val any, message ...string) error
- type Assertion
- func (a *Assertion) DeepEqual(actual, expect any, message ...string) error
- func (a *Assertion) DeepEqualNow(actual, expect any, message ...string) error
- func (a *Assertion) Nil(val any, message ...string) error
- func (a *Assertion) NilNow(val any, message ...string) error
- func (a *Assertion) NotDeepEqual(actual, expect any, message ...string) error
- func (a *Assertion) NotDeepEqualNow(actual, expect any, message ...string) error
- func (a *Assertion) NotNil(val any, message ...string) error
- func (a *Assertion) NotNilNow(val any, message ...string) error
- func (a *Assertion) NotPanic(fn func(), message ...string) error
- func (a *Assertion) NotPanicNow(fn func(), message ...string) error
- func (a *Assertion) NotTrue(val any, message ...string) error
- func (a *Assertion) NotTrueNow(val any, message ...string) error
- func (a *Assertion) Panic(fn func(), message ...string) error
- func (a *Assertion) PanicNow(fn func(), message ...string) error
- func (a *Assertion) True(val any, message ...string) error
- func (a *Assertion) TrueNow(val any, message ...string) error
- type AssertionError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepEqual ¶
DeepEqual tests the deep equality between actual and expect parameters. It'll set the result to fail if they are not deeply equal, and it doesn't stop the execution.
func DeepEqualNow ¶ added in v0.1.2
DeepEqualNow tests the deep equality between actual and expect parameters, and it'll stop the execution if they are not deeply equal.
func Nil ¶ added in v0.1.1
Nil tests whether a value is nil or not, and it'll fail when the value is not nil. It will always return false if the value is a bool, an integer, a floating number, a complex, or a string.
func NilNow ¶ added in v0.1.2
NilNow tests whether a value is nil or not, and it'll fail when the value is not nil. It will always return false if the value is a bool, an integer, a floating number, a complex, or a string.
This function will set the result to fail, and stop the execution if the value is not nil.
func NotDeepEqual ¶
NotDeepEqual tests the deep inequality between actual and expected parameters. It'll set the result to fail if they are deeply equal, but it doesn't stop the execution.
func NotDeepEqualNow ¶ added in v0.1.2
NotDeepEqualNow tests the deep inequality between actual and expected parameters, and it'll stop the execution if they are deeply equal.
func NotNil ¶ added in v0.1.1
NotNil tests whether a value is nil or not, and it'll fail when the value is nil. It will always return true if the value is a bool, an integer, a floating number, a complex, or a string.
func NotNilNow ¶ added in v0.1.2
NotNilNow tests whether a value is nil or not, and it'll fail when the value is nil. It will always return true if the value is a bool, an integer, a floating number, a complex, or a string.
This function will set the result to fail, and stop the execution if the value is nil.
func NotPanic ¶
NotPanic asserts that the function fn does not panic, and it'll set the result to fail if the function panic.
func NotPanicNow ¶ added in v0.1.2
NotPanicNow asserts that the function fn does not panic. It'll set the result to fail if the function panic, and it also stops the execution.
func NotTrue ¶ added in v0.1.4
NotTrue tests whether a value is truthy or not. It'll set the result to fail if the value is a truthy value. For most types of value, a falsy value is the zero value for its type. For a slice, a truthy value should not be nil, and its length must be greater than 0. For nil, the value is always falsy.
func NotTrueNow ¶ added in v0.1.4
NotTrueNow tests whether a value is truthy or not. It'll set the result to fail if the value is a truthy value. For most types of value, a falsy value is the zero value for its type. For a slice, a truthy value should not be nil, and its length must be greater than 0. For nil, the value is always falsy.
The function will stop the execution if the value is truthy.
func Panic ¶
Panic expects the function fn to panic, and it'll set the result to fail if the function doesn't panic.
func PanicNow ¶ added in v0.1.2
PanicNow expects the function fn to panic. It'll set the result to fail if the function doesn't panic, and stop the execution.
func True ¶ added in v0.1.4
True tests whether a value is truthy or not. It'll set the result to fail if the value is a false value. For most types of value, a falsy value is the zero value for its type. For a slice, a truthy value should not be nil, and its length must be greater than 0. For nil, the value is always falsy.
func TrueNow ¶ added in v0.1.4
TrueNow tests whether a value is truthy or not. It'll set the result to fail if the value is a false value. For most types of value, a falsy value is the zero value for its type. For a slice, a truthy value should not be nil, and its length must be greater than 0. For nil, the value is always falsy.
The function will stop the execution if the value is falsy.
Types ¶
type Assertion ¶
func (*Assertion) DeepEqual ¶
DeepEqual tests the deep equality between actual and expect parameters. It'll set the result to fail if they are not deeply equal, and it doesn't stop the execution.
func (*Assertion) DeepEqualNow ¶ added in v0.1.2
DeepEqualNow tests the deep equality between actual and expect parameters, and it'll stop the execution if they are not deeply equal.
func (*Assertion) Nil ¶ added in v0.1.1
Nil tests whether a value is nil or not, and it'll fail when the value is not nil. It will always return false if the value is a bool, an integer, a floating number, a complex, or a string.
func (*Assertion) NilNow ¶ added in v0.1.2
NilNow tests whether a value is nil or not, and it'll fail when the value is not nil. It will always return false if the value is a bool, an integer, a floating number, a complex, or a string.
This function will set the result to fail, and stop the execution if the value is not nil.
func (*Assertion) NotDeepEqual ¶
NotDeepEqual tests the deep inequality between actual and expected parameters. It'll set the result to fail if they are deeply equal, but it doesn't stop the execution.
func (*Assertion) NotDeepEqualNow ¶ added in v0.1.2
NotDeepEqualNow tests the deep inequality between actual and expected parameters, and it'll stop the execution if they are deeply equal.
func (*Assertion) NotNil ¶ added in v0.1.1
NotNil tests whether a value is nil or not, and it'll fail when the value is nil. It will always return true if the value is a bool, an integer, a floating number, a complex, or a string.
func (*Assertion) NotNilNow ¶ added in v0.1.2
NotNilNow tests whether a value is nil or not, and it'll fail when the value is nil. It will always return true if the value is a bool, an integer, a floating number, a complex, or a string.
This function will set the result to fail, and stop the execution if the value is nil.
func (*Assertion) NotPanic ¶
NotPanic asserts that the function fn does not panic, and it'll set the result to fail if the function panic.
func (*Assertion) NotPanicNow ¶ added in v0.1.2
NotPanicNow asserts that the function fn does not panic. It'll set the result to fail if the function panic, and it also stops the execution.
func (*Assertion) NotTrue ¶ added in v0.1.4
NotTrue tests whether a value is truthy or not. It'll set the result to fail if the value is a truthy value. For most types of value, a falsy value is the zero value for its type. For a slice, a truthy value should not be nil, and its length must be greater than 0. For nil, the value is always falsy.
func (*Assertion) NotTrueNow ¶ added in v0.1.4
NotTrueNow tests whether a value is truthy or not. It'll set the result to fail if the value is a truthy value. For most types of value, a falsy value is the zero value for its type. For a slice, a truthy value should not be nil, and its length must be greater than 0. For nil, the value is always falsy.
The function will stop the execution if the value is truthy.
func (*Assertion) Panic ¶
Panic expects the function fn to panic, and it'll set the result to fail if the function doesn't panic.
func (*Assertion) PanicNow ¶ added in v0.1.2
PanicNow expects the function fn to panic. It'll set the result to fail if the function doesn't panic, and stop the execution.
func (*Assertion) True ¶ added in v0.1.4
True tests whether a value is truthy or not. It'll set the result to fail if the value is a false value. For most types of value, a falsy value is the zero value for its type. For a slice, a truthy value should not be nil, and its length must be greater than 0. For nil, the value is always falsy.
func (*Assertion) TrueNow ¶ added in v0.1.4
TrueNow tests whether a value is truthy or not. It'll set the result to fail if the value is a false value. For most types of value, a falsy value is the zero value for its type. For a slice, a truthy value should not be nil, and its length must be greater than 0. For nil, the value is always falsy.
The function will stop the execution if the value is falsy.
type AssertionError ¶
type AssertionError struct {
// contains filtered or unexported fields
}
AssertionError indicates the failure of an assertion.
func (AssertionError) Error ¶
func (err AssertionError) Error() string
Error returns the message of the error.