MCPcopy Create free account

hub / github.com/stretchr/testify / functions

Functions1,305 in github.com/stretchr/testify

↓ 2 callersFunctionEqualValuesf
EqualValuesf asserts that two objects are equal or convertible to the larger type and equal. assert.EqualValuesf(t, uint32(123), int32(123), "error
assert/assertion_format.go:111
↓ 2 callersFunctionEqualf
Equalf asserts that two objects are equal. assert.Equalf(t, 123, 123, "error message %s", "formatted") Pointer variable equality is determined base
assert/assertion_format.go:71
↓ 2 callersFunctionError
Error asserts that a function returned an error (i.e. not `nil`). actualObj, err := SomeFunction() if require.Error(t, err) { require.Equa
require/require.go:286
↓ 2 callersFunctionErrorAsf
ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. This is a wrapper for erro
assert/assertion_format.go:133
↓ 2 callersFunctionErrorContains
ErrorContains asserts that a function returned an error (i.e. not `nil`) and that the error contains the specified substring. actualObj, err := Some
require/require.go:325
↓ 2 callersFunctionErrorContainsf
ErrorContainsf asserts that a function returned an error (i.e. not `nil`) and that the error contains the specified substring. actualObj, err := Som
assert/assertion_format.go:145
↓ 2 callersFunctionErrorIsf
ErrorIsf asserts that at least one of the errors in err's chain matches target. This is a wrapper for errors.Is.
assert/assertion_format.go:154
↓ 2 callersFunctionEventuallyWithTf
EventuallyWithTf asserts that given condition will be met in waitFor time, periodically checking target function each tick. In contrast to Eventually,
assert/assertion_format.go:190
↓ 2 callersFunctionEventuallyf
Eventuallyf asserts that given condition will be met in waitFor time, periodically checking target function each tick. assert.Eventuallyf(t, func()
assert/assertion_format.go:165
↓ 2 callersFunctionExactly
Exactly asserts that two objects are equal in value and type. require.Exactly(t, int32(123), int64(123))
require/require.go:477
↓ 2 callersFunctionExactlyf
Exactlyf asserts that two objects are equal in value and type. assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted")
assert/assertion_format.go:200
↓ 2 callersMethodFail
Fail reports a failure through
require/require_forward.go:405
↓ 2 callersFunctionFailNowf
FailNowf fails test
assert/assertion_format.go:216
↓ 2 callersFunctionFailf
Failf reports a failure through
assert/assertion_format.go:208
↓ 2 callersMethodFalse
False asserts that the specified value is false. a.False(myBool)
require/require_forward.go:439
↓ 2 callersFunctionFalsef
Falsef asserts that the specified value is false. assert.Falsef(t, myBool, "error message %s", "formatted")
assert/assertion_format.go:226
↓ 2 callersFunctionFileExistsf
FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check
assert/assertion_format.go:235
↓ 2 callersFunctionGreaterOrEqualf
GreaterOrEqualf asserts that the first element is greater than or equal to the second assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted
assert/assertion_format.go:260
↓ 2 callersFunctionGreaterf
Greaterf asserts that the first element is greater than the second assert.Greaterf(t, 2, 1, "error message %s", "formatted") assert.Greaterf(t, flo
assert/assertion_format.go:247
↓ 2 callersFunctionHTTPBody
HTTPBody is a helper that returns HTTP body of the response. It returns empty string if building a new request fails.
assert/http_assertions.go:114
↓ 2 callersFunctionHTTPBodyContainsf
HTTPBodyContainsf asserts that a specified handler returns a body that contains a string. assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.
assert/assertion_format.go:273
↓ 2 callersFunctionHTTPBodyNotContainsf
HTTPBodyNotContainsf asserts that a specified handler returns a body that does not contain a string. assert.HTTPBodyNotContainsf(t, myHandler, "GET"
assert/assertion_format.go:286
↓ 2 callersFunctionHTTPErrorf
HTTPErrorf asserts that a specified handler returns an error status code. assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string
assert/assertion_format.go:298
↓ 2 callersFunctionHTTPRedirectf
HTTPRedirectf asserts that a specified handler returns a redirect status code. assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": [
assert/assertion_format.go:310
↓ 2 callersFunctionHTTPStatusCodef
HTTPStatusCodef asserts that a specified handler returns a specified status code. assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil
assert/assertion_format.go:322
↓ 2 callersFunctionHTTPSuccessf
HTTPSuccessf asserts that a specified handler returns a success status code. assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil,
assert/assertion_format.go:334
↓ 2 callersFunctionImplements
Implements asserts that an object is implemented by the specified interface. require.Implements(t, (*MyInterface)(nil), new(MyObject))
require/require.go:843
↓ 2 callersMethodImplements
Implements asserts that an object is implemented by the specified interface. a.Implements((*MyInterface)(nil), new(MyObject))
require/require_forward.go:675
↓ 2 callersFunctionImplementsf
Implementsf asserts that an object is implemented by the specified interface. assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error messa
assert/assertion_format.go:344
↓ 2 callersFunctionInDelta
InDelta asserts that the two numerals are within delta of each other. require.InDelta(t, math.Pi, 22/7.0, 0.01)
require/require.go:869
↓ 2 callersFunctionInDeltaMapValuesf
InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
assert/assertion_format.go:362
↓ 2 callersFunctionInDeltaSlicef
InDeltaSlicef is the same as InDelta, except it compares two slices.
assert/assertion_format.go:370
↓ 2 callersFunctionInDeltaf
InDeltaf asserts that the two numerals are within delta of each other. assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
assert/assertion_format.go:354
↓ 2 callersFunctionInEpsilonSlicef
InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
assert/assertion_format.go:386
↓ 2 callersFunctionInEpsilonf
InEpsilonf asserts that expected and actual have a relative error less than epsilon
assert/assertion_format.go:378
↓ 2 callersFunctionInOrder
InOrder defines the order in which the calls should be made For example: InOrder( Mock.On("init").Return(nil), Mock.On("Do").Return(nil), )
mock/mock.go:284
↓ 2 callersFunctionIsDecreasingf
IsDecreasingf asserts that the collection is decreasing assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted") assert.IsDecreasin
assert/assertion_format.go:398
↓ 2 callersFunctionIsIncreasingf
IsIncreasingf asserts that the collection is increasing assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted") assert.IsIncreasin
assert/assertion_format.go:410
↓ 2 callersFunctionIsNonDecreasingf
IsNonDecreasingf asserts that the collection is not decreasing assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted") assert.I
assert/assertion_format.go:422
↓ 2 callersFunctionIsNonIncreasingf
IsNonIncreasingf asserts that the collection is not increasing assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted") assert.I
assert/assertion_format.go:434
↓ 2 callersFunctionIsType
IsType returns an IsTypeArgument object containing the type to check for. You can provide a zero-value of the type to check. This is an alternative t
mock/mock.go:826
↓ 2 callersFunctionIsType
IsType asserts that the specified objects are of the same type.
require/require.go:1101
↓ 2 callersFunctionIsTypef
IsTypef asserts that the specified objects are of the same type.
assert/assertion_format.go:442
↓ 2 callersFunctionJSONEqf
JSONEqf asserts that two JSON strings are equivalent. assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "err
assert/assertion_format.go:452
↓ 2 callersFunctionLenf
Lenf asserts that the specified object has specific length. Lenf also fails if the object has a type that len() not accept. assert.Lenf(t, mySlice,
assert/assertion_format.go:463
↓ 2 callersFunctionLessOrEqualf
LessOrEqualf asserts that the first element is less than or equal to the second assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted") asser
assert/assertion_format.go:488
↓ 2 callersFunctionLessf
Lessf asserts that the first element is less than the second assert.Lessf(t, 1, 2, "error message %s", "formatted") assert.Lessf(t, float64(1), flo
assert/assertion_format.go:475
↓ 2 callersFunctionNegativef
Negativef asserts that the specified element is negative assert.Negativef(t, -1, "error message %s", "formatted") assert.Negativef(t, -1.23, "error
assert/assertion_format.go:499
↓ 2 callersFunctionNeverf
Neverf asserts that the given condition doesn't satisfy in waitFor time, periodically checking the target function each tick. assert.Neverf(t, func(
assert/assertion_format.go:510
↓ 2 callersFunctionNil
Nil asserts that the specified object is nil. require.Nil(t, err)
require/require.go:1297
↓ 2 callersFunctionNilf
Nilf asserts that the specified object is nil. assert.Nilf(t, err, "error message %s", "formatted")
assert/assertion_format.go:520
↓ 2 callersFunctionNoDirExistsf
NoDirExistsf checks whether a directory does not exist in the given path. It fails if the path points to an existing _directory_ only.
assert/assertion_format.go:529
↓ 2 callersFunctionNoErrorf
NoErrorf asserts that a function returned no error (i.e. `nil`). actualObj, err := SomeFunction() if assert.NoErrorf(t, err, "error message %s"
assert/assertion_format.go:542
↓ 2 callersFunctionNoFileExistsf
NoFileExistsf checks whether a file does not exist in a given path. It fails if the path points to an existing _file_ only.
assert/assertion_format.go:551
↓ 2 callersFunctionNotContains
NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the specified substring or element. require.NotContains
require/require.go:1406
↓ 2 callersFunctionNotContainsf
NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the specified substring or element. assert.NotContains
assert/assertion_format.go:564
↓ 2 callersFunctionNotElementsMatchf
NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified listB(array, slice...) ignoring the order of the element
assert/assertion_format.go:581
↓ 2 callersFunctionNotEmptyf
NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either a slice or a channel with len == 0. if assert.NotEmp
assert/assertion_format.go:594
↓ 2 callersFunctionNotEqualValuesf
NotEqualValuesf asserts that two objects are not equal even when converted to the same type assert.NotEqualValuesf(t, obj1, obj2, "error message %s"
assert/assertion_format.go:617
↓ 2 callersFunctionNotEqualf
NotEqualf asserts that the specified values are NOT equal. assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted") Pointer variable equali
assert/assertion_format.go:607
↓ 2 callersFunctionNotErrorAsf
NotErrorAsf asserts that none of the errors in err's chain matches target, but if so, sets target to that error value.
assert/assertion_format.go:626
↓ 2 callersFunctionNotErrorIsf
NotErrorIsf asserts that none of the errors in err's chain matches target. This is a wrapper for errors.Is.
assert/assertion_format.go:635
↓ 2 callersFunctionNotImplementsf
NotImplementsf asserts that an object does not implement the specified interface. assert.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "erro
assert/assertion_format.go:645
↓ 2 callersFunctionNotNil
NotNil asserts that the specified object is not nil. require.NotNil(t, err)
require/require.go:1639
↓ 2 callersFunctionNotNilf
NotNilf asserts that the specified object is not nil. assert.NotNilf(t, err, "error message %s", "formatted")
assert/assertion_format.go:655
↓ 2 callersFunctionNotPanicsf
NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s",
assert/assertion_format.go:665
↓ 2 callersFunctionNotRegexpf
NotRegexpf asserts that a specified regexp does not match a string. assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error messa
assert/assertion_format.go:676
↓ 2 callersFunctionNotSamef
NotSamef asserts that two pointers do not reference the same object. assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted") Both arguments
assert/assertion_format.go:689
↓ 2 callersFunctionNotSubsetf
NotSubsetf asserts that the specified list(array, slice...) or map does NOT contain all elements given in the specified subset list(array, slice...) o
assert/assertion_format.go:702
↓ 2 callersFunctionNotZero
NotZero asserts that i is not the zero value for its type.
require/require.go:1781
↓ 2 callersFunctionNotZerof
NotZerof asserts that i is not the zero value for its type.
assert/assertion_format.go:710
↓ 2 callersMethodPanic
Panic specifies if the function call should fail and the panic message Mock.On("DoSomething").Panic("test panic")
mock/mock.go:120
↓ 2 callersFunctionPanics
Panics asserts that the code inside the specified PanicTestFunc panics. require.Panics(t, func(){ GoCrazy() })
require/require.go:1805
↓ 2 callersFunctionPanicsWithErrorf
PanicsWithErrorf asserts that the code inside the specified PanicTestFunc panics, and that the recovered panic value is an error that satisfies the Eq
assert/assertion_format.go:732
↓ 2 callersFunctionPanicsWithValuef
PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that the recovered panic value equals the expected panic value.
assert/assertion_format.go:743
↓ 2 callersFunctionPanicsf
Panicsf asserts that the code inside the specified PanicTestFunc panics. assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
assert/assertion_format.go:720
↓ 2 callersFunctionPositivef
Positivef asserts that the specified element is positive assert.Positivef(t, 1, "error message %s", "formatted") assert.Positivef(t, 1.23, "error m
assert/assertion_format.go:754
↓ 2 callersFunctionRegexpf
Regexpf asserts that a specified regexp matches a string. assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "forma
assert/assertion_format.go:765
↓ 2 callersFunctionSamef
Samef asserts that two pointers reference the same object. assert.Samef(t, ptr1, ptr2, "error message %s", "formatted") Both arguments must be poin
assert/assertion_format.go:778
↓ 2 callersMethodSetT
(*testing.T)
suite/interfaces.go:9
↓ 2 callersFunctionSubsetf
Subsetf asserts that the specified list(array, slice...) or map contains all elements given in the specified subset list(array, slice...) or map. as
assert/assertion_format.go:790
↓ 2 callersMethodTheExampleMethodFunc
(fn func(string) error)
mock/mock_test.go:103
↓ 2 callersMethodTheExampleMethodFuncType
(fn ExampleFuncType)
mock/mock_test.go:125
↓ 2 callersMethodTheExampleMethodVariadicInterface
(a ...interface{})
mock/mock_test.go:113
↓ 2 callersFunctionTruef
Truef asserts that the specified value is true. assert.Truef(t, myBool, "error message %s", "formatted")
assert/assertion_format.go:800
↓ 2 callersMethodWaitUntil
WaitUntil sets the channel that will block the mock's return until its closed or a message is received. Mock.On("MyMethod", arg1, arg2).WaitUntil(ti
mock/mock.go:158
↓ 2 callersFunctionWithinDuration
WithinDuration asserts that the two times are within duration delta of each other. require.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
require/require.go:2033
↓ 2 callersFunctionWithinDurationf
WithinDurationf asserts that the two times are within duration delta of each other. assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second
assert/assertion_format.go:810
↓ 2 callersFunctionWithinRangef
WithinRangef asserts that a time is within a time range (inclusive). assert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add
assert/assertion_format.go:820
↓ 2 callersMethodWrite
Deprecated: Use [net/http/httptest] instead.
http/test_response_writer.go:31
↓ 2 callersFunctionYAMLEqf
YAMLEqf asserts that two YAML strings are equivalent.
assert/assertion_format.go:828
↓ 2 callersFunctionZero
Zero asserts that i is the zero value for its type.
require/require.go:2105
↓ 2 callersFunctionZerof
Zerof asserts that i is the zero value for its type.
assert/assertion_format.go:836
↓ 2 callersMethodcheckExpectation
(call *Call)
mock/mock.go:641
↓ 2 callersMethodcheckResultAndErrMsg
(t *testing.T, expectedRes, res bool, expectedErrMsg string)
assert/assertions_test.go:3185
↓ 2 callersMethodexpectedCalls
()
mock/mock.go:761
↓ 2 callersMethodfail
fail fails the current test with the given formatted format and args. In case that a test was defined, it uses the test APIs for failing a test, other
mock/mock.go:344
↓ 2 callersFunctionfailOnPanic
(t *testing.T, r interface{})
suite/suite.go:86
↓ 2 callersMethodfailed
()
assert/assertions.go:1994
↓ 2 callersFunctiongetLen
getLen tries to get the length of an object. It returns (0, false) if impossible.
assert/assertions.go:783
← previousnext →201–300 of 1,305, ranked by callers