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 Equal(t *testing.T, actual, expect any, message ...string) error
- func EqualNow(t *testing.T, actual, expect any, message ...string) error
- func Match(t *testing.T, val string, pattern *regexp.Regexp, message ...string) error
- func MatchNow(t *testing.T, val string, pattern *regexp.Regexp, message ...string) error
- func MatchString(t *testing.T, val, pattern string, message ...string) error
- func MatchStringNow(t *testing.T, val, pattern string, 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 NotEqual(t *testing.T, actual, expect any, message ...string) error
- func NotEqualNow(t *testing.T, actual, expect any, message ...string) error
- func NotMatch(t *testing.T, val string, pattern *regexp.Regexp, message ...string) error
- func NotMatchNow(t *testing.T, val string, pattern *regexp.Regexp, message ...string) error
- func NotMatchString(t *testing.T, val, pattern string, message ...string) error
- func NotMatchStringNow(t *testing.T, val, pattern string, 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) Equal(actual, expect any, message ...string) error
- func (a *Assertion) EqualNow(actual, expect any, message ...string) error
- func (a *Assertion) Match(val string, pattern *regexp.Regexp, message ...string) error
- func (a *Assertion) MatchNow(val string, pattern *regexp.Regexp, message ...string) error
- func (a *Assertion) MatchString(val, pattern string, message ...string) error
- func (a *Assertion) MatchStringNow(val, pattern string, 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) NotEqual(actual, expect any, message ...string) error
- func (a *Assertion) NotEqualNow(actual, expect any, message ...string) error
- func (a *Assertion) NotMatch(val string, pattern *regexp.Regexp, message ...string) error
- func (a *Assertion) NotMatchNow(val string, pattern *regexp.Regexp, message ...string) error
- func (a *Assertion) NotMatchString(val, pattern string, message ...string) error
- func (a *Assertion) NotMatchStringNow(val, pattern string, 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 (assertion *Assertion) Run(name string, f func(a *Assertion)) bool
- 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 Equal ¶ added in v0.1.5
Equal tests the equality between actual and expect parameters. It'll set the result to fail if they are not equal, and it doesn't stop the execution.
func EqualNow ¶ added in v0.1.5
EqualNow tests the equality between actual and expect parameters, and it'll stop the execution if they are not equal.
func MatchNow ¶ added in v0.1.5
MatchNow tests whether the string matches the regular expression or not, and it will terminate the execution if it does not match.
func MatchString ¶ added in v0.1.5
MatchString will compile the pattern and test whether the string matches the regular expression or not. It will panic if the pattern is not a valid regular expression.
func MatchStringNow ¶ added in v0.1.5
MatchStringNow will compile the pattern and test whether the string matches the regular expression or not. It will terminate the execution if it does not match, and it will panic if the pattern is not a valid regular expression.
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 NotEqual ¶ added in v0.1.5
NotEqual tests the inequality between actual and expected parameters. It'll set the result to fail if they are equal, but it doesn't stop the execution.
func NotEqualNow ¶ added in v0.1.5
NotEqualNow tests the inequality between actual and expected parameters, and it'll stop the execution if they are equal.
func NotMatch ¶ added in v0.1.5
NotMatch tests whether the string matches the regular expression or not, and it set the result to fail if the string matches the pattern.
func NotMatchNow ¶ added in v0.1.5
NotMatchNow tests whether the string matches the regular expression or not, and it will terminate the execution if the string matches the pattern.
func NotMatchString ¶ added in v0.1.5
MatchString will compile the pattern and test whether the string matches the regular expression or not, and it set the result to fail if the string matches the pattern. It will also panic if the pattern is not a valid regular expression.
func NotMatchStringNow ¶ added in v0.1.5
NotMatchStringNow will compile the pattern and test whether the string matches the regular expression or not, and it set the result to fail if the string matches the pattern. It will terminate the execution if the string matches the pattern, and it will panic if the pattern is not a valid regular expression.
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) Equal ¶ added in v0.1.5
Equal tests the equality between actual and expect parameters. It'll set the result to fail if they are not equal, and it doesn't stop the execution.
func (*Assertion) EqualNow ¶ added in v0.1.5
EqualNow tests the equality between actual and expect parameters, and it'll stop the execution if they are not equal.
func (*Assertion) Match ¶ added in v0.1.5
Match tests whether the string matches the regular expression or not.
func (*Assertion) MatchNow ¶ added in v0.1.5
MatchNow tests whether the string matches the regular expression or not, and it will terminate the execution if it does not match.
func (*Assertion) MatchString ¶ added in v0.1.5
MatchString will compile the pattern and test whether the string matches the regular expression or not. It will panic if the pattern is not a valid regular expression.
func (*Assertion) MatchStringNow ¶ added in v0.1.5
MatchStringNow will compile the pattern and test whether the string matches the regular expression or not. It will terminate the execution if it does not match, and it will panic if the pattern is not a valid regular expression.
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) NotEqual ¶ added in v0.1.5
NotEqual tests the inequality between actual and expected parameters. It'll set the result to fail if they are equal, but it doesn't stop the execution.
func (*Assertion) NotEqualNow ¶ added in v0.1.5
NotEqualNow tests the inequality between actual and expected parameters, and it'll stop the execution if they are equal.
func (*Assertion) NotMatch ¶ added in v0.1.5
NotMatch tests whether the string matches the regular expression or not, and it set the result to fail if the string matches the pattern.
func (*Assertion) NotMatchNow ¶ added in v0.1.5
NotMatchNow tests whether the string matches the regular expression or not, and it will terminate the execution if the string matches the pattern.
func (*Assertion) NotMatchString ¶ added in v0.1.5
MatchString will compile the pattern and test whether the string matches the regular expression or not, and it set the result to fail if the string matches the pattern. It will also panic if the pattern is not a valid regular expression.
func (*Assertion) NotMatchStringNow ¶ added in v0.1.5
NotMatchStringNow will compile the pattern and test whether the string matches the regular expression or not, and it set the result to fail if the string matches the pattern. It will terminate the execution if the string matches the pattern, and it will panic if the pattern is not a valid regular expression.
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) Run ¶ added in v0.1.1
Run runs f as a subtest of a called name. It runs f in a separate goroutine and blocks until f returns or calls a.Parallel to become a parallel test. Run reports whether f succeeded (or at least did not fail before calling t.Parallel).
Run may be called simultaneously from multiple goroutines, but all such calls must return before the outer test function for a returns.
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.