MCPcopy Create free account

hub / github.com/stretchr/testify / functions

Functions1,305 in github.com/stretchr/testify

↓ 609 callersMethodHelper
()
mock/mock.go:1201
↓ 150 callersMethodFailNow
()
require/requirements.go:6
↓ 89 callersFunctionFalse
False asserts that the specified value is false. assert.False(t, myBool)
assert/assertions.go:828
↓ 86 callersMethodError
Error asserts that a function returned an error (i.e. not `nil`). actualObj, err := SomeFunction() if a.Error(err) { assert.Equal(t, expec
require/require_forward.go:232
↓ 86 callersMethodOn
On chains a new expectation description onto the mocked interface. This allows syntax like. Mock. On("MyMethod", 1).Return(nil). On("MyOther
mock/mock.go:207
↓ 81 callersFunctionEqual
Equal asserts that two objects are equal. assert.Equal(t, 123, 123) Pointer variable equality is determined based on the equality of the referenced
assert/assertions.go:460
↓ 81 callersMethodReturn
Return specifies the return arguments for the expectation. Mock.On("DoSomething").Return(errors.New("failed"))
mock/mock.go:108
↓ 76 callersMethodError
()
assert/assertions_test.go:1593
↓ 75 callersFunctionFail
Fail reports a failure through
assert/assertions.go:348
↓ 73 callersFunctionTrue
True asserts that the specified value is true. assert.True(t, myBool)
assert/assertions.go:813
↓ 57 callersFunctionNew
New makes a new Assertions object for the specified TestingT.
assert/forward_assertions.go:10
↓ 50 callersMethodRun
(name string, f func(t *testing.T))
suite/suite.go:252
↓ 44 callersFunctionNew
New makes a new Assertions object for the specified TestingT.
require/forward_requirements.go:10
↓ 37 callersMethodCalled
Called tells the mock object that a method has been called, and gets an array of arguments to return. Panics if the call is unexpected (i.e. not prec
mock/mock.go:465
↓ 32 callersMethodErrorf
(format string, args ...interface{})
require/requirements.go:5
↓ 25 callersFunctionContains
Contains asserts that the specified string, list(array, slice...) or map contains the specified substring or element. assert.Contains(t, "Hello Worl
assert/assertions.go:927
↓ 24 callersFunctionEqual
Equal asserts that two objects are equal. require.Equal(t, 123, 123) Pointer variable equality is determined based on the equality of the reference
require/require.go:155
↓ 21 callersMethodOnce
Once indicates that the mock should only return the value once. Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Once()
mock/mock.go:132
↓ 21 callersFunctionPanics
Panics asserts that the code inside the specified PanicTestFunc panics. assert.Panics(t, func(){ GoCrazy() })
assert/assertions.go:1248
↓ 21 callersMethodString
()
assert/assertions_test.go:2458
↓ 20 callersMethodAssertExpectations
(TestingT)
mock/mock.go:585
↓ 18 callersMethodName
()
require/requirements_test.go:522
↓ 17 callersMethodFalse
False asserts that the specified value is false. a.False(myBool)
assert/assertion_forward.go:438
↓ 17 callersMethodTrue
True asserts that the specified value is true. a.True(myBool)
assert/assertion_forward.go:1586
↓ 16 callersMethodError
Error 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:1110
↓ 14 callersMethodContains
Contains asserts that the specified string, list(array, slice...) or map contains the specified substring or element. a.Contains("Hello World", "Wor
assert/assertion_forward.go:33
↓ 14 callersMethodDiff
Diff gets a string describing the differences between the arguments and the specified objects. Returns the diff string and number of differences foun
mock/mock.go:945
↓ 14 callersFunctionNotPanics
NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. assert.NotPanics(t, func(){ RemainCalm() })
assert/assertions.go:1305
↓ 14 callersFunctionRegexp
Regexp asserts that a specified regexp matches a string. assert.Regexp(t, regexp.MustCompile("start"), "it's starting") assert.Regexp(t, "start...$
assert/assertions.go:1677
↓ 13 callersFunctionJSONEq
JSONEq asserts that two JSON strings are equivalent. assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
assert/assertions.go:1807
↓ 13 callersFunctionNotNil
NotNil asserts that the specified object is not nil. assert.NotNil(t, err)
assert/assertions.go:674
↓ 13 callersFunctionYAMLEq
YAMLEq asserts that two YAML strings are equivalent.
assert/assertions.go:1825
↓ 12 callersMethodGet
Get Returns the argument at the specified index.
mock/mock.go:924
↓ 12 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)
assert/assertion_forward.go:911
↓ 12 callersFunctionObjectsAreEqual
* Helper functions */ ObjectsAreEqual determines if two objects are considered equal. This function does no assertion of any kind.
assert/assertions.go:64
↓ 12 callersMethodT
()
suite/interfaces.go:8
↓ 11 callersFunctionJSONEq
JSONEq asserts that two JSON strings are equivalent. require.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
require/require.go:1125
↓ 11 callersFunctionLen
Len asserts that the specified object has specific length. Len also fails if the object has a type that len() not accept. assert.Len(t, mySlice, 3)
assert/assertions.go:795
↓ 11 callersFunctionMatchedBy
MatchedBy can be used to match a mock call based on only certain properties from a complex struct or some calculation. It takes a function that will b
mock/mock.go:907
↓ 11 callersFunctionYAMLEq
YAMLEq asserts that two YAML strings are equivalent.
require/require.go:2083
↓ 11 callersMethoderrorString
()
assert/assertions_test.go:2653
↓ 10 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()
assert/assertions.go:1614
↓ 10 callersMethodJSONEq
JSONEq asserts that two JSON strings are equivalent. a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
assert/assertion_forward.go:890
↓ 10 callersMethodJSONEq
JSONEq asserts that two JSON strings are equivalent. a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
require/require_forward.go:891
↓ 10 callersFunctionNil
Nil asserts that the specified object is nil. assert.Nil(t, err)
assert/assertions.go:706
↓ 10 callersMethodString
String provides a %v format string for Mock. Note: this is used implicitly by Arguments.Diff if a Mock is passed. It exists because go's default %v fo
mock/mock.go:316
↓ 10 callersMethodTheExampleMethod2
go:noinline
mock/mock_test.go:70
↓ 10 callersMethodYAMLEq
YAMLEq asserts that two YAML strings are equivalent.
assert/assertion_forward.go:1644
↓ 10 callersMethodYAMLEq
YAMLEq asserts that two YAML strings are equivalent.
require/require_forward.go:1645
↓ 9 callersFunctionAnythingOfType
AnythingOfType returns a special value containing the name of the type to check for. The type name will be matched against the type name returned by [
mock/mock.go:808
↓ 9 callersFunctionNotEqual
NotEqual asserts that the specified values are NOT equal. assert.NotEqual(t, obj1, obj2) Pointer variable equality is determined based on the equal
assert/assertions.go:846
↓ 9 callersFunctionRun
Run takes a testing suite and runs all of the tests attached to it.
suite/suite.go:121
↓ 9 callersMethodTheExampleMethod
(a, b, c int)
mock/mock_test.go:22
↓ 9 callersFunctioncompareTwoValues
(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAn
assert/assertion_compare.go:458
↓ 9 callersMethodlock
()
mock/mock.go:97
↓ 8 callersMethodEqual
Equal asserts that two objects are equal. a.Equal(123, 123) Pointer variable equality is determined based on the equality of the referenced values
assert/assertion_forward.go:124
↓ 8 callersFunctionEventuallyWithT
EventuallyWithT asserts that given condition will be met in waitFor time, periodically checking target function each tick. In contrast to Eventually,
assert/assertions.go:2016
↓ 8 callersMethodFailed
()
assert/assertions_test.go:2662
↓ 8 callersMethodNotBefore
NotBefore indicates that the mock should only be called after the referenced calls have been called as expected. The referenced calls may be from the
mock/mock.go:262
↓ 8 callersFunctionNotPanics
NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. require.NotPanics(t, func(){ RemainCalm() })
require/require.go:1665
↓ 8 callersMethodWriteHeader
Deprecated: Use [net/http/httptest] instead.
http/test_response_writer.go:47
↓ 8 callersMethodcall
(method string)
suite/suite_test.go:481
↓ 8 callersMethodunlock
()
mock/mock.go:101
↓ 7 callersFunctionPanicsWithValue
PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that the recovered panic value equals the expected panic value.
require/require.go:1849
↓ 7 callersMethodTwice
Twice indicates that the mock should only return the value twice. Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Twice()
mock/mock.go:139
↓ 7 callersFunctiondiff
diff returns a diff of both values as long as both are of the same type and are a struct, map, slice, array or string. Otherwise it returns an empty s
assert/assertions.go:1855
↓ 7 callersMethodisBetterMatchThan
(other matchCandidate)
mock/mock.go:402
↓ 6 callersMethodAfter
After sets how long to block until the call returns Mock.On("MyMethod", arg1, arg2).After(time.Second)
mock/mock.go:168
↓ 6 callersFunctionCallerInfo
* CallerInfo is necessary because the assert functions use the testing object internally, causing it to print the file:line of the assert method, rath
assert/assertions.go:212
↓ 6 callersMethodEqual
Equal asserts that two objects are equal. a.Equal(123, 123) Pointer variable equality is determined based on the equality of the referenced values
require/require_forward.go:125
↓ 6 callersFunctionError
Error asserts that a function returned an error (i.e. not `nil`). actualObj, err := SomeFunction() if assert.Error(t, err) { assert.Equal(
assert/assertions.go:1598
↓ 6 callersFunctionEventually
Eventually asserts that given condition will be met in waitFor time, periodically checking target function each tick. assert.Eventually(t, func() bo
assert/assertions.go:1930
↓ 6 callersFunctionHTTPSuccess
HTTPSuccess asserts that a specified handler returns a success status code. assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
assert/http_assertions.go:29
↓ 6 callersFunctionInDelta
InDelta asserts that the two numerals are within delta of each other. assert.InDelta(t, math.Pi, 22/7.0, 0.01)
assert/assertions.go:1395
↓ 6 callersFunctionNotContains
NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the specified substring or element. assert.NotContains(
assert/assertions.go:950
↓ 6 callersFunctionNotZero
NotZero asserts that i is not the zero value for its type.
assert/assertions.go:1721
↓ 6 callersFunctionObjectsAreEqualValues
ObjectsAreEqualValues gets whether two objects are equal, or if their values are equal.
assert/assertions.go:164
↓ 6 callersMethodUnset
Unset removes a mock handler from being called. test.On("func", mock.Anything).Unset()
mock/mock.go:214
↓ 6 callersMethodZero
Zero asserts that i is the zero value for its type.
assert/assertion_forward.go:1660
↓ 6 callersMethodcall
(method string)
suite/suite_test.go:588
↓ 6 callersFunctiondidPanic
didPanic returns true if the function passed to it panics. Otherwise, it returns false.
assert/assertions.go:1228
↓ 5 callersFunctionEmpty
Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either a slice or a channel with len == 0. assert.Empty(t, obj)
assert/assertions.go:749
↓ 5 callersFunctionFailNow
FailNow fails test
assert/assertions.go:327
↓ 5 callersFunctionFunctionalOptions
FunctionalOptions returns an [FunctionalOptionsArgument] object containing the expected functional-options to check for. For example: args.Assert(t
mock/mock.go:852
↓ 5 callersFunctionGreater
Greater asserts that the first element is greater than the second assert.Greater(t, 2, 1) assert.Greater(t, float64(2), float64(1)) assert.Greater
assert/assertion_compare.go:389
↓ 5 callersFunctionGreaterOrEqual
GreaterOrEqual asserts that the first element is greater than or equal to the second assert.GreaterOrEqual(t, 2, 1) assert.GreaterOrEqual(t, 2, 2)
assert/assertion_compare.go:402
↓ 5 callersFunctionInEpsilon
InEpsilon asserts that expected and actual have a relative error less than epsilon
assert/assertions.go:1518
↓ 5 callersFunctionIsDecreasing
IsDecreasing asserts that the collection is decreasing assert.IsDecreasing(t, []int{2, 1, 0}) assert.IsDecreasing(t, []float{2, 1}) assert.IsDecre
assert/assertion_order.go:70
↓ 5 callersFunctionIsIncreasing
IsIncreasing asserts that the collection is increasing assert.IsIncreasing(t, []int{1, 2, 3}) assert.IsIncreasing(t, []float{1, 2}) assert.IsIncre
assert/assertion_order.go:52
↓ 5 callersFunctionIsNonDecreasing
IsNonDecreasing asserts that the collection is not decreasing assert.IsNonDecreasing(t, []int{1, 1, 2}) assert.IsNonDecreasing(t, []float{1, 2}) a
assert/assertion_order.go:79
↓ 5 callersFunctionIsNonIncreasing
IsNonIncreasing asserts that the collection is not increasing assert.IsNonIncreasing(t, []int{2, 1, 1}) assert.IsNonIncreasing(t, []float{2, 1}) a
assert/assertion_order.go:61
↓ 5 callersFunctionIsType
IsType asserts that the specified objects are of the same type.
assert/assertions.go:441
↓ 5 callersFunctionLess
Less asserts that the first element is less than the second assert.Less(t, 1, 2) assert.Less(t, float64(1), float64(2)) assert.Less(t, "a", "b")
assert/assertion_compare.go:414
↓ 5 callersFunctionLessOrEqual
LessOrEqual asserts that the first element is less than or equal to the second assert.LessOrEqual(t, 1, 2) assert.LessOrEqual(t, 2, 2) assert.Less
assert/assertion_compare.go:427
↓ 5 callersFunctionNegative
Negative asserts that the specified element is negative assert.Negative(t, -1) assert.Negative(t, -1.23)
assert/assertion_compare.go:450
↓ 5 callersFunctionNever
Never asserts that the given condition doesn't satisfy in waitFor time, periodically checking the target function each tick. assert.Never(t, func()
assert/assertions.go:2061
↓ 5 callersFunctionNotSubset
NotSubset asserts that the specified list(array, slice...) or map does NOT contain all elements given in the specified subset list(array, slice...) or
assert/assertions.go:1030
↓ 5 callersFunctionOpStr
(s string)
mock/mock_test.go:48
↓ 5 callersFunctionPanicsWithValue
PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that the recovered panic value equals the expected panic value.
assert/assertions.go:1264
↓ 5 callersFunctionPositive
Positive asserts that the specified element is positive assert.Positive(t, 1) assert.Positive(t, 1.23)
assert/assertion_compare.go:438
next →1–100 of 1,305, ranked by callers