MCPcopy Create free account

hub / github.com/stretchr/testify / functions

Functions1,305 in github.com/stretchr/testify

↓ 5 callersMethodRequire
Require returns a require context for suite.
suite/suite.go:57
↓ 5 callersMethodTheExampleMethodFunctionalOptions
(x string, opts ...OptionFn)
mock/mock_test.go:60
↓ 5 callersMethodTimes
Times indicates that the mock should only return the indicated number of times. Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Times
mock/mock.go:147
↓ 5 callersFunctionTrue
True asserts that the specified value is true. require.True(t, myBool)
require/require.go:2007
↓ 5 callersFunctioncontainsElement
containsElement try loop over the list check if the list includes the element. return (false, false) if impossible. return (true, false) if element wa
assert/assertions.go:882
↓ 5 callersMethodfindExpectedCall
* Recording and responding to activity */
mock/mock.go:378
↓ 5 callersFunctionisEmpty
isEmpty gets whether the specified object is considered empty or not.
assert/assertions.go:717
↓ 4 callersMethodAssertCalled
AssertCalled asserts that the method was called. It can produce a false result when an argument is a pointer type and the underlying value changed aft
mock/mock.go:669
↓ 4 callersFunctionCondition
Condition uses a Comparison to assert a complex condition.
assert/assertions.go:1212
↓ 4 callersFunctionDirExists
DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking wh
assert/assertions.go:1768
↓ 4 callersFunctionElementsMatch
ElementsMatch asserts that the specified listA(array, slice...) is equal to specified listB(array, slice...) ignoring the order of the elements. If th
assert/assertions.go:1087
↓ 4 callersFunctionEqualExportedValues
EqualExportedValues asserts that the types of two objects are equal and their public fields are also equal. This is useful for comparing structs that
assert/assertions.go:626
↓ 4 callersFunctionErrorAs
ErrorAs 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 error
assert/assertions.go:2138
↓ 4 callersFunctionErrorContains
ErrorContains asserts that a function returned an error (i.e. not `nil`) and that the error contains the specified substring. actualObj, err := Some
assert/assertions.go:1637
↓ 4 callersFunctionErrorIs
ErrorIs asserts that at least one of the errors in err's chain matches target. This is a wrapper for errors.Is.
assert/assertions.go:2092
↓ 4 callersFunctionExactly
Exactly asserts that two objects are equal in value and type. assert.Exactly(t, int32(123), int64(123))
assert/assertions.go:655
↓ 4 callersMethodFailNow
()
assert/assertions.go:323
↓ 4 callersFunctionFalse
False asserts that the specified value is false. require.False(t, myBool)
require/require.go:547
↓ 4 callersFunctionFileExists
FileExists 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 t
assert/assertions.go:1733
↓ 4 callersFunctionHTTPBodyContains
HTTPBodyContains asserts that a specified handler returns a body that contains a string. assert.HTTPBodyContains(t, myHandler, "GET", "www.google.co
assert/http_assertions.go:133
↓ 4 callersFunctionHTTPBodyNotContains
HTTPBodyNotContains asserts that a specified handler returns a body that does not contain a string. assert.HTTPBodyNotContains(t, myHandler, "GET",
assert/http_assertions.go:153
↓ 4 callersFunctionHTTPError
HTTPError asserts that a specified handler returns an error status code. assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"
assert/http_assertions.go:73
↓ 4 callersFunctionHTTPRedirect
HTTPRedirect asserts that a specified handler returns a redirect status code. assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []s
assert/http_assertions.go:51
↓ 4 callersFunctionHTTPStatusCode
HTTPStatusCode asserts that a specified handler returns a specified status code. assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil,
assert/http_assertions.go:95
↓ 4 callersFunctionImplements
Implements asserts that an object is implemented by the specified interface. assert.Implements(t, (*MyInterface)(nil), new(MyObject))
assert/assertions.go:405
↓ 4 callersFunctionInDeltaMapValues
InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
assert/assertions.go:1452
↓ 4 callersFunctionInDeltaSlice
InDeltaSlice is the same as InDelta, except it compares two slices.
assert/assertions.go:1428
↓ 4 callersFunctionInEpsilonSlice
InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
assert/assertions.go:1541
↓ 4 callersMethodLen
Len asserts that the specified object has specific length. Len also fails if the object has a type that len() not accept. a.Len(mySlice, 3)
require/require_forward.go:912
↓ 4 callersMethodLogf
(format string, args ...interface{})
mock/mock.go:26
↓ 4 callersMethodMethodCalled
MethodCalled tells the mock object that the given method has been called, and gets an array of arguments to return. Panics if the call is unexpected (
mock/mock.go:488
↓ 4 callersFunctionNoDirExists
NoDirExists checks whether a directory does not exist in the given path. It fails if the path points to an existing _directory_ only.
assert/assertions.go:1787
↓ 4 callersFunctionNoError
* Errors */ NoError asserts that a function returned no error (i.e. `nil`). actualObj, err := SomeFunction() if assert.NoError(t, err) {
assert/assertions.go:1581
↓ 4 callersFunctionNoFileExists
NoFileExists checks whether a file does not exist in a given path. It fails if the path points to an existing _file_ only.
assert/assertions.go:1752
↓ 4 callersFunctionNotElementsMatch
NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified listB(array, slice...) ignoring the order of the elements
assert/assertions.go:1188
↓ 4 callersFunctionNotEmpty
NotEmpty 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.NotEmpt
assert/assertions.go:768
↓ 4 callersFunctionNotEqualValues
NotEqualValues asserts that two objects are not equal even when converted to the same type assert.NotEqualValues(t, obj1, obj2)
assert/assertions.go:866
↓ 4 callersFunctionNotErrorAs
NotErrorAs asserts that none of the errors in err's chain matches target, but if so, sets target to that error value.
assert/assertions.go:2156
↓ 4 callersFunctionNotErrorIs
NotErrorIs asserts that none of the errors in err's chain matches target. This is a wrapper for errors.Is.
assert/assertions.go:2115
↓ 4 callersFunctionNotImplements
NotImplements asserts that an object does not implement the specified interface. assert.NotImplements(t, (*MyInterface)(nil), new(MyObject))
assert/assertions.go:424
↓ 4 callersFunctionNotRegexp
NotRegexp asserts that a specified regexp does not match a string. assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") assert.NotReg
assert/assertions.go:1695
↓ 4 callersFunctionNotSame
NotSame asserts that two pointers do not reference the same object. assert.NotSame(t, ptr1, ptr2) Both arguments must be pointer variables. Pointer
assert/assertions.go:526
↓ 4 callersFunctionPanicsWithError
PanicsWithError asserts that the code inside the specified PanicTestFunc panics, and that the recovered panic value is an error that satisfies the Equ
assert/assertions.go:1285
↓ 4 callersFunctionSame
Same asserts that two pointers reference the same object. assert.Same(t, ptr1, ptr2) Both arguments must be pointer variables. Pointer variable sam
assert/assertions.go:500
↓ 4 callersFunctionSubset
Subset asserts that the specified list(array, slice...) or map contains all elements given in the specified subset list(array, slice...) or map. ass
assert/assertions.go:972
↓ 4 callersMethodTheExampleMethod7
(slice []bool)
mock/mock_test.go:98
↓ 4 callersFunctionWithinDuration
WithinDuration asserts that the two times are within duration delta of each other. assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
assert/assertions.go:1320
↓ 4 callersFunctionWithinRange
WithinRange asserts that a time is within a time range (inclusive). assert.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(t
assert/assertions.go:1336
↓ 4 callersFunctionZero
Zero asserts that i is the zero value for its type.
assert/assertions.go:1710
↓ 4 callersFunctionbuildErrorChainString
(err error)
assert/assertions.go:2172
↓ 4 callersFunctioncleanUpTempFiles
(paths []string)
assert/assertions_test.go:2248
↓ 4 callersFunctionformatUnequalValues
formatUnequalValues takes two values of arbitrary types and returns string representations appropriate to be presented to the user. If the values are
assert/assertions.go:570
↓ 4 callersFunctiongetTempSymlinkPath
(file string)
assert/assertions_test.go:2242
↓ 4 callersFunctionhttpCode
httpCode is a helper that returns HTTP code of the response. It returns -1 and an error if building a new request fails.
assert/http_assertions.go:13
↓ 4 callersFunctionisOrdered
isOrdered checks that collection contains orderable elements.
assert/assertion_order.go:9
↓ 4 callersFunctionunexpectedCallRegex
(method, calledArg, expectedArg, diff string)
mock/mock_test.go:2208
↓ 3 callersFunctionAssertExpectationsForObjects
AssertExpectationsForObjects asserts that everything specified with On and Return of the specified objects was in fact called as expected. Calls may
mock/mock.go:592
↓ 3 callersMethodBool
Bool gets the argument at the specified index. Panics if there is no argument, or if the argument is of the wrong type.
mock/mock.go:1125
↓ 3 callersMethodCall
()
mock/mock_test.go:2241
↓ 3 callersFunctionEqualValues
EqualValues asserts that two objects are equal or convertible to the larger type and equal. assert.EqualValues(t, uint32(123), int32(123))
assert/assertions.go:599
↓ 3 callersFunctionErrorf
Errorf asserts that a function returned an error (i.e. not `nil`). actualObj, err := SomeFunction() if assert.Errorf(t, err, "error message %s"
assert/assertion_format.go:124
↓ 3 callersFunctionEventuallyWithT
EventuallyWithT asserts that given condition will be met in waitFor time, periodically checking target function each tick. In contrast to Eventually,
require/require.go:422
↓ 3 callersMethodGetTime
(i int)
mock/mock_test.go:2022
↓ 3 callersMethodImplements
Implements asserts that an object is implemented by the specified interface. a.Implements((*MyInterface)(nil), new(MyObject))
assert/assertion_forward.go:674
↓ 3 callersMethodInt
Int gets the argument at the specified index. Panics if there is no argument, or if the argument is of the wrong type.
mock/mock.go:1099
↓ 3 callersMethodIs
Is gets whether the objects match the arguments specified.
mock/mock.go:932
↓ 3 callersFunctionNoError
NoError asserts that a function returned no error (i.e. `nil`). actualObj, err := SomeFunction() if require.NoError(t, err) { require.Equa
require/require.go:1350
↓ 3 callersFunctionNotEmpty
NotEmpty 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 require.NotEmp
require/require.go:1478
↓ 3 callersFunctionNotEqual
NotEqual asserts that the specified values are NOT equal. require.NotEqual(t, obj1, obj2) Pointer variable equality is determined based on the equa
require/require.go:1510
↓ 3 callersMethodNotEqual
NotEqual asserts that the specified values are NOT equal. a.NotEqual(obj1, obj2) Pointer variable equality is determined based on the equality of t
require/require_forward.go:1198
↓ 3 callersFunctionOpNum
(n int)
mock/mock_test.go:42
↓ 3 callersMethodParams
()
_codegen/main.go:230
↓ 3 callersMethodPassed
()
suite/stats.go:38
↓ 3 callersMethodTheExampleMethod3
(et *ExampleType)
mock/mock_test.go:78
↓ 3 callersMethodTrue
True asserts that the specified value is true. a.True(myBool)
require/require_forward.go:1587
↓ 3 callersFunctioncallString
(method string, arguments Arguments, includeArgumentValues bool)
mock/mock.go:444
↓ 3 callersMethodcalls
()
mock/mock.go:765
↓ 3 callersFunctioncompare
(obj1, obj2 interface{}, kind reflect.Kind)
assert/assertion_compare.go:45
↓ 3 callersFunctioncontainsValue
(values []compareResult, value compareResult)
assert/assertion_compare.go:481
↓ 3 callersFunctioncopyExportedFields
copyExportedFields iterates downward through nested data structures and creates a copy that only contains the exported struct fields.
assert/assertions.go:86
↓ 3 callersFunctiondiffLists
diffLists diffs two arrays/slices and returns slices of elements that are only in A and only in B. If some element is present multiple times, each ins
assert/assertions.go:1121
↓ 3 callersFunctionisNil
isNil checks if a specified object is nil or not, without Failing.
assert/assertions.go:685
↓ 3 callersMethodmethodWasCalled
(methodName string, expected []interface{})
mock/mock.go:744
↓ 3 callersFunctionnewSuiteInformation
()
suite/stats.go:18
↓ 3 callersFunctionptr
(i int)
assert/assertions_test.go:608
↓ 3 callersFunctionsamePointers
samePointers checks if two generic interface objects are pointers of the same type pointing to the same object. It returns two values: same indicating
assert/assertions.go:549
↓ 3 callersFunctionvalidateEqualArgs
validateEqualArgs checks whether provided arguments can be safely used in the Equal/NotEqual functions.
assert/assertions.go:483
↓ 2 callersMethodAssert
Assert returns an assert context for suite. Normally, you can call `suite.NoError(expected, actual)`, but for situations where the embedded methods a
suite/suite.go:71
↓ 2 callersMethodComment
()
_codegen/main.go:284
↓ 2 callersFunctionConditionf
Conditionf uses a Comparison to assert a complex condition.
assert/assertion_format.go:12
↓ 2 callersFunctionContains
Contains asserts that the specified string, list(array, slice...) or map contains the specified substring or element. require.Contains(t, "Hello Wor
require/require.go:40
↓ 2 callersFunctionContainsf
Containsf asserts that the specified string, list(array, slice...) or map contains the specified substring or element. assert.Containsf(t, "Hello Wo
assert/assertion_format.go:25
↓ 2 callersMethodCopy
Deprecated: That was a method for internal usage that should not have been published. Now just panics.
assert/assertions.go:1984
↓ 2 callersFunctionDirExistsf
DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking w
assert/assertion_format.go:34
↓ 2 callersFunctionElementsMatchf
ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified listB(array, slice...) ignoring the order of the elements. If t
assert/assertion_format.go:46
↓ 2 callersFunctionEmpty
Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either a slice or a channel with len == 0. require.Empty(t, obj)
require/require.go:124
↓ 2 callersFunctionEmptyf
Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either a slice or a channel with len == 0. assert.Emptyf(t, obj, "erro
assert/assertion_format.go:57
↓ 2 callersFunctionEqualError
EqualError asserts that a function returned an error (i.e. not `nil`) and that it is equal to the provided error. actualObj, err := SomeFunction()
require/require.go:170
↓ 2 callersFunctionEqualErrorf
EqualErrorf asserts that a function returned an error (i.e. not `nil`) and that it is equal to the provided error. actualObj, err := SomeFunction()
assert/assertion_format.go:83
↓ 2 callersFunctionEqualExportedValuesf
EqualExportedValuesf asserts that the types of two objects are equal and their public fields are also equal. This is useful for comparing structs that
assert/assertion_format.go:100
← previousnext →101–200 of 1,305, ranked by callers