repo
stringlengths 5
67
| sha
stringlengths 40
40
| path
stringlengths 4
234
| url
stringlengths 85
339
| language
stringclasses 6
values | split
stringclasses 3
values | doc
stringlengths 3
51.2k
| sign
stringlengths 5
8.01k
| problem
stringlengths 13
51.2k
| output
stringlengths 0
3.87M
|
---|---|---|---|---|---|---|---|---|---|
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L396-L404 | go | train | // 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(t, "b", "a") | func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) | // 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(t, "b", "a")
func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.Greater(t, e1, e2, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L428-L436 | go | train | // GreaterOrEqualf asserts that the first element in greater or equal than the second
//
// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted") | func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) | // GreaterOrEqualf asserts that the first element in greater or equal than the second
//
// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted")
func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.GreaterOrEqualf(t, e1, e2, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L459-L467 | go | train | // HTTPBodyContains asserts that a specified handler returns a
// body that contains a string.
//
// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false). | func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) | // HTTPBodyContains asserts that a specified handler returns a
// body that contains a string.
//
// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L475-L483 | go | train | // HTTPBodyContainsf asserts that a specified handler returns a
// body that contains a string.
//
// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false). | func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) | // HTTPBodyContainsf asserts that a specified handler returns a
// body that contains a string.
//
// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L610-L618 | go | train | // Implements asserts that an object is implemented by the specified interface.
//
// assert.Implements(t, (*MyInterface)(nil), new(MyObject)) | func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) | // Implements asserts that an object is implemented by the specified interface.
//
// assert.Implements(t, (*MyInterface)(nil), new(MyObject))
func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.Implements(t, interfaceObject, object, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L636-L644 | go | train | // InDelta asserts that the two numerals are within delta of each other.
//
// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01) | func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) | // InDelta asserts that the two numerals are within delta of each other.
//
// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)
func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.InDelta(t, expected, actual, delta, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L658-L666 | go | train | // InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. | func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) | // InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L704-L712 | go | train | // InEpsilon asserts that expected and actual have a relative error less than epsilon | func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) | // InEpsilon asserts that expected and actual have a relative error less than epsilon
func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L726-L734 | go | train | // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. | func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) | // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L748-L756 | go | train | // IsType asserts that the specified objects are of the same type. | func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) | // IsType asserts that the specified objects are of the same type.
func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.IsType(t, expectedType, object, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L759-L767 | go | train | // IsTypef asserts that the specified objects are of the same type. | func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) | // IsTypef asserts that the specified objects are of the same type.
func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.IsTypef(t, expectedType, object, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L772-L780 | go | train | // JSONEq asserts that two JSON strings are equivalent.
//
// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) | func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) | // JSONEq asserts that two JSON strings are equivalent.
//
// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.JSONEq(t, expected, actual, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L799-L807 | go | train | // 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) | func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) | // 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)
func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.Len(t, object, length, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L813-L821 | go | train | // 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, 3, "error message %s", "formatted") | func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) | // 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, 3, "error message %s", "formatted")
func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.Lenf(t, object, length, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L949-L957 | go | train | // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
// assert.NotContains(t, "Hello World", "Earth")
// assert.NotContains(t, ["Hello", "World"], "Earth")
// assert.NotContains(t, {"Hello": "World"}, "Earth") | func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) | // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
// assert.NotContains(t, "Hello World", "Earth")
// assert.NotContains(t, ["Hello", "World"], "Earth")
// assert.NotContains(t, {"Hello": "World"}, "Earth")
func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.NotContains(t, s, contains, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L965-L973 | go | train | // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted") | func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) | // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.NotContainsf(t, s, contains, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L981-L989 | go | train | // 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.NotEmpty(t, obj) {
// assert.Equal(t, "two", obj[1])
// } | func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) | // 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.NotEmpty(t, obj) {
// assert.Equal(t, "two", obj[1])
// }
func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.NotEmpty(t, object, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1068-L1076 | go | train | // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
//
// assert.NotPanics(t, func(){ RemainCalm() }) | func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) | // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
//
// assert.NotPanics(t, func(){ RemainCalm() })
func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.NotPanics(t, f, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1081-L1089 | go | train | // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
//
// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") | func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) | // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
//
// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.NotPanicsf(t, f, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1095-L1103 | go | train | // NotRegexp asserts that a specified regexp does not match a string.
//
// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
// assert.NotRegexp(t, "^start", "it's not starting") | func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) | // NotRegexp asserts that a specified regexp does not match a string.
//
// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
// assert.NotRegexp(t, "^start", "it's not starting")
func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.NotRegexp(t, rx, str, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1109-L1117 | go | train | // NotRegexpf asserts that a specified regexp does not match a string.
//
// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") | func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) | // NotRegexpf asserts that a specified regexp does not match a string.
//
// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.NotRegexpf(t, rx, str, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1186-L1194 | go | train | // PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
// the recovered panic value equals the expected panic value.
//
// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() }) | func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) | // PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
// the recovered panic value equals the expected panic value.
//
// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.PanicsWithValue(t, expected, f, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1287-L1295 | go | train | // Subset asserts that the specified list(array, slice...) contains all
// elements given in the specified subset(array, slice...).
//
// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") | func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) | // Subset asserts that the specified list(array, slice...) contains all
// elements given in the specified subset(array, slice...).
//
// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.Subset(t, list, subset, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1301-L1309 | go | train | // Subsetf asserts that the specified list(array, slice...) contains all
// elements given in the specified subset(array, slice...).
//
// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") | func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) | // Subsetf asserts that the specified list(array, slice...) contains all
// elements given in the specified subset(array, slice...).
//
// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.Subsetf(t, list, subset, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1314-L1322 | go | train | // True asserts that the specified value is true.
//
// assert.True(t, myBool) | func True(t TestingT, value bool, msgAndArgs ...interface{}) | // True asserts that the specified value is true.
//
// assert.True(t, myBool)
func True(t TestingT, value bool, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.True(t, value, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1327-L1335 | go | train | // Truef asserts that the specified value is true.
//
// assert.Truef(t, myBool, "error message %s", "formatted") | func Truef(t TestingT, value bool, msg string, args ...interface{}) | // Truef asserts that the specified value is true.
//
// assert.Truef(t, myBool, "error message %s", "formatted")
func Truef(t TestingT, value bool, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.Truef(t, value, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1340-L1348 | go | train | // WithinDuration asserts that the two times are within duration delta of each other.
//
// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second) | func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) | // WithinDuration asserts that the two times are within duration delta of each other.
//
// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1353-L1361 | go | train | // WithinDurationf asserts that the two times are within duration delta of each other.
//
// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") | func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) | // WithinDurationf asserts that the two times are within duration delta of each other.
//
// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.WithinDurationf(t, expected, actual, delta, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1364-L1372 | go | train | // Zero asserts that i is the zero value for its type. | func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) | // Zero asserts that i is the zero value for its type.
func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.Zero(t, i, msgAndArgs...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | require/require.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L1375-L1383 | go | train | // Zerof asserts that i is the zero value for its type. | func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) | // Zerof asserts that i is the zero value for its type.
func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if assert.Zerof(t, i, msg, args...) {
return
}
t.FailNow()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L15-L20 | go | train | // Condition uses a Comparison to assert a complex condition. | func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool | // Condition uses a Comparison to assert a complex condition.
func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return Condition(a.t, comp, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L100-L105 | go | train | // Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// a.Empty(obj) | func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool | // Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// a.Empty(obj)
func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return Empty(a.t, object, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L263-L268 | go | train | // Failf reports a failure through | func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool | // Failf reports a failure through
func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return Failf(a.t, failureMessage, msg, args...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L273-L278 | go | train | // False asserts that the specified value is false.
//
// a.False(myBool) | func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool | // False asserts that the specified value is false.
//
// a.False(myBool)
func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return False(a.t, value, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L349-L354 | go | train | // Greaterf asserts that the first element is greater than the second
//
// a.Greaterf(2, 1, "error message %s", "formatted")
// a.Greaterf(float64(2, "error message %s", "formatted"), float64(1))
// a.Greaterf("b", "a", "error message %s", "formatted") | func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool | // Greaterf asserts that the first element is greater than the second
//
// a.Greaterf(2, 1, "error message %s", "formatted")
// a.Greaterf(float64(2, "error message %s", "formatted"), float64(1))
// a.Greaterf("b", "a", "error message %s", "formatted")
func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return Greaterf(a.t, e1, e2, msg, args...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L461-L466 | go | train | // HTTPSuccess asserts that a specified handler returns a success status code.
//
// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
//
// Returns whether the assertion was successful (true) or not (false). | func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool | // HTTPSuccess asserts that a specified handler returns a success status code.
//
// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L473-L478 | go | train | // HTTPSuccessf asserts that a specified handler returns a success status code.
//
// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false). | func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool | // HTTPSuccessf asserts that a specified handler returns a success status code.
//
// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return HTTPSuccessf(a.t, handler, method, url, values, msg, args...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L483-L488 | go | train | // Implements asserts that an object is implemented by the specified interface.
//
// a.Implements((*MyInterface)(nil), new(MyObject)) | func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool | // Implements asserts that an object is implemented by the specified interface.
//
// a.Implements((*MyInterface)(nil), new(MyObject))
func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return Implements(a.t, interfaceObject, object, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L503-L508 | go | train | // InDelta asserts that the two numerals are within delta of each other.
//
// a.InDelta(math.Pi, (22 / 7.0), 0.01) | func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool | // InDelta asserts that the two numerals are within delta of each other.
//
// a.InDelta(math.Pi, (22 / 7.0), 0.01)
func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return InDelta(a.t, expected, actual, delta, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L553-L558 | go | train | // InEpsilon asserts that expected and actual have a relative error less than epsilon | func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool | // InEpsilon asserts that expected and actual have a relative error less than epsilon
func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L585-L590 | go | train | // IsType asserts that the specified objects are of the same type. | func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool | // IsType asserts that the specified objects are of the same type.
func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return IsType(a.t, expectedType, object, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L624-L629 | go | train | // 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) | func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool | // 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)
func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return Len(a.t, object, length, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L796-L801 | go | train | // NotEqual asserts that the specified values are NOT equal.
//
// a.NotEqual(obj1, obj2)
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). | func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool | // NotEqual asserts that the specified values are NOT equal.
//
// a.NotEqual(obj1, obj2)
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return NotEqual(a.t, expected, actual, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L809-L814 | go | train | // NotEqualf asserts that the specified values are NOT equal.
//
// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). | func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool | // NotEqualf asserts that the specified values are NOT equal.
//
// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return NotEqualf(a.t, expected, actual, msg, args...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L849-L854 | go | train | // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
//
// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted") | func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool | // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
//
// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return NotPanicsf(a.t, f, msg, args...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L901-L906 | go | train | // NotZero asserts that i is not the zero value for its type. | func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool | // NotZero asserts that i is not the zero value for its type.
func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return NotZero(a.t, i, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_forward.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L962-L967 | go | train | // Regexp asserts that a specified regexp matches a string.
//
// a.Regexp(regexp.MustCompile("start"), "it's starting")
// a.Regexp("start...$", "it's not starting") | func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool | // Regexp asserts that a specified regexp matches a string.
//
// a.Regexp(regexp.MustCompile("start"), "it's starting")
// a.Regexp("start...$", "it's not starting")
func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool | {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
return Regexp(a.t, rx, str, msgAndArgs...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/http_assertions.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/http_assertions.go#L29-L45 | go | train | // HTTPSuccess asserts that a specified handler returns a success status code.
//
// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
//
// Returns whether the assertion was successful (true) or not (false). | func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool | // HTTPSuccess asserts that a specified handler returns a success status code.
//
// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
code, err := httpCode(handler, method, url, values)
if err != nil {
Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err))
return false
}
isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent
if !isSuccessCode {
Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code))
}
return isSuccessCode
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/http_assertions.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/http_assertions.go#L52-L68 | go | train | // HTTPRedirect asserts that a specified handler returns a redirect status code.
//
// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false). | func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool | // HTTPRedirect asserts that a specified handler returns a redirect status code.
//
// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
code, err := httpCode(handler, method, url, values)
if err != nil {
Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err))
return false
}
isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect
if !isRedirectCode {
Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code))
}
return isRedirectCode
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/http_assertions.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/http_assertions.go#L75-L91 | go | train | // HTTPError asserts that a specified handler returns an error status code.
//
// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false). | func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool | // HTTPError asserts that a specified handler returns an error status code.
//
// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
code, err := httpCode(handler, method, url, values)
if err != nil {
Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err))
return false
}
isErrorCode := code >= http.StatusBadRequest
if !isErrorCode {
Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code))
}
return isErrorCode
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/http_assertions.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/http_assertions.go#L95-L103 | go | train | // HTTPBody is a helper that returns HTTP body of the response. It returns
// empty string if building a new request fails. | func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string | // HTTPBody is a helper that returns HTTP body of the response. It returns
// empty string if building a new request fails.
func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string | {
w := httptest.NewRecorder()
req, err := http.NewRequest(method, url+"?"+values.Encode(), nil)
if err != nil {
return ""
}
handler(w, req)
return w.Body.String()
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/http_assertions.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/http_assertions.go#L111-L123 | go | train | // HTTPBodyContains asserts that a specified handler returns a
// body that contains a string.
//
// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false). | func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool | // HTTPBodyContains asserts that a specified handler returns a
// body that contains a string.
//
// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
body := HTTPBody(handler, method, url, values)
contains := strings.Contains(body, fmt.Sprint(str))
if !contains {
Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body))
}
return contains
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | suite/suite.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/suite/suite.go#L33-L37 | go | train | // SetT sets the current *testing.T context. | func (suite *Suite) SetT(t *testing.T) | // SetT sets the current *testing.T context.
func (suite *Suite) SetT(t *testing.T) | {
suite.t = t
suite.Assertions = assert.New(t)
suite.require = require.New(t)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | suite/suite.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/suite/suite.go#L40-L45 | go | train | // Require returns a require context for suite. | func (suite *Suite) Require() *require.Assertions | // Require returns a require context for suite.
func (suite *Suite) Require() *require.Assertions | {
if suite.require == nil {
suite.require = require.New(suite.T())
}
return suite.require
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | suite/suite.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/suite/suite.go#L52-L57 | go | train | // Assert returns an assert context for suite. Normally, you can call
// `suite.NoError(expected, actual)`, but for situations where the embedded
// methods are overridden (for example, you might want to override
// assert.Assertions with require.Assertions), this method is provided so you
// can call `suite.Assert().NoError()`. | func (suite *Suite) Assert() *assert.Assertions | // Assert returns an assert context for suite. Normally, you can call
// `suite.NoError(expected, actual)`, but for situations where the embedded
// methods are overridden (for example, you might want to override
// assert.Assertions with require.Assertions), this method is provided so you
// can call `suite.Assert().NoError()`.
func (suite *Suite) Assert() *assert.Assertions | {
if suite.Assertions == nil {
suite.Assertions = assert.New(suite.T())
}
return suite.Assertions
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | suite/suite.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/suite/suite.go#L71-L78 | go | train | // Run provides suite functionality around golang subtests. It should be
// called in place of t.Run(name, func(t *testing.T)) in test suite code.
// The passed-in func will be executed as a subtest with a fresh instance of t.
// Provides compatibility with go test pkg -run TestSuite/TestName/SubTestName. | func (suite *Suite) Run(name string, subtest func()) bool | // Run provides suite functionality around golang subtests. It should be
// called in place of t.Run(name, func(t *testing.T)) in test suite code.
// The passed-in func will be executed as a subtest with a fresh instance of t.
// Provides compatibility with go test pkg -run TestSuite/TestName/SubTestName.
func (suite *Suite) Run(name string, subtest func()) bool | {
oldT := suite.T()
defer suite.SetT(oldT)
return oldT.Run(name, func(t *testing.T) {
suite.SetT(t)
subtest()
})
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | suite/suite.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/suite/suite.go#L82-L139 | go | train | // Run takes a testing suite and runs all of the tests attached
// to it. | func Run(t *testing.T, suite TestingSuite) | // Run takes a testing suite and runs all of the tests attached
// to it.
func Run(t *testing.T, suite TestingSuite) | {
suite.SetT(t)
defer failOnPanic(t)
suiteSetupDone := false
methodFinder := reflect.TypeOf(suite)
tests := []testing.InternalTest{}
for index := 0; index < methodFinder.NumMethod(); index++ {
method := methodFinder.Method(index)
ok, err := methodFilter(method.Name)
if err != nil {
fmt.Fprintf(os.Stderr, "testify: invalid regexp for -m: %s\n", err)
os.Exit(1)
}
if !ok {
continue
}
if !suiteSetupDone {
if setupAllSuite, ok := suite.(SetupAllSuite); ok {
setupAllSuite.SetupSuite()
}
defer func() {
if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok {
tearDownAllSuite.TearDownSuite()
}
}()
suiteSetupDone = true
}
test := testing.InternalTest{
Name: method.Name,
F: func(t *testing.T) {
parentT := suite.T()
suite.SetT(t)
defer failOnPanic(t)
if setupTestSuite, ok := suite.(SetupTestSuite); ok {
setupTestSuite.SetupTest()
}
if beforeTestSuite, ok := suite.(BeforeTest); ok {
beforeTestSuite.BeforeTest(methodFinder.Elem().Name(), method.Name)
}
defer func() {
if afterTestSuite, ok := suite.(AfterTest); ok {
afterTestSuite.AfterTest(methodFinder.Elem().Name(), method.Name)
}
if tearDownTestSuite, ok := suite.(TearDownTestSuite); ok {
tearDownTestSuite.TearDownTest()
}
suite.SetT(parentT)
}()
method.Func.Call([]reflect.Value{reflect.ValueOf(suite)})
},
}
tests = append(tests, test)
}
runTests(t, tests)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | suite/suite.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/suite/suite.go#L157-L162 | go | train | // Filtering method according to set regular expression
// specified command-line argument -m | func methodFilter(name string) (bool, error) | // Filtering method according to set regular expression
// specified command-line argument -m
func methodFilter(name string) (bool, error) | {
if ok, _ := regexp.MatchString("^Test", name); !ok {
return false, nil
}
return regexp.MatchString(*matchMethod, name)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L15-L20 | go | train | // Conditionf uses a Comparison to assert a complex condition. | func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool | // Conditionf uses a Comparison to assert a complex condition.
func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Condition(t, comp, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L28-L33 | go | train | // Containsf asserts that the specified string, list(array, slice...) or map contains the
// specified substring or element.
//
// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted") | func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool | // Containsf asserts that the specified string, list(array, slice...) or map contains the
// specified substring or element.
//
// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Contains(t, s, contains, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L36-L41 | go | train | // 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 whether it exists. | func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool | // 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 whether it exists.
func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return DirExists(t, path, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L48-L53 | go | train | // ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
// the number of appearances of each of them in both lists should match.
//
// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") | func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool | // ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
// the number of appearances of each of them in both lists should match.
//
// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L59-L64 | go | train | // 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, "error message %s", "formatted") | func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool | // 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, "error message %s", "formatted")
func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Empty(t, object, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L73-L78 | go | train | // Equalf asserts that two objects are equal.
//
// assert.Equalf(t, 123, 123, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). Function equality
// cannot be determined and will always fail. | func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool | // Equalf asserts that two objects are equal.
//
// assert.Equalf(t, 123, 123, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). Function equality
// cannot be determined and will always fail.
func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Equal(t, expected, actual, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L85-L90 | go | train | // 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.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted") | func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool | // 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.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L96-L101 | go | train | // EqualValuesf asserts that two objects are equal or convertable to the same types
// and equal.
//
// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123)) | func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool | // EqualValuesf asserts that two objects are equal or convertable to the same types
// and equal.
//
// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L109-L114 | go | train | // Errorf asserts that a function returned an error (i.e. not `nil`).
//
// actualObj, err := SomeFunction()
// if assert.Errorf(t, err, "error message %s", "formatted") {
// assert.Equal(t, expectedErrorf, err)
// } | func Errorf(t TestingT, err error, msg string, args ...interface{}) bool | // Errorf asserts that a function returned an error (i.e. not `nil`).
//
// actualObj, err := SomeFunction()
// if assert.Errorf(t, err, "error message %s", "formatted") {
// assert.Equal(t, expectedErrorf, err)
// }
func Errorf(t TestingT, err error, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Error(t, err, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L119-L124 | go | train | // Exactlyf asserts that two objects are equal in value and type.
//
// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123)) | func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool | // Exactlyf asserts that two objects are equal in value and type.
//
// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L127-L132 | go | train | // Failf reports a failure through | func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool | // Failf reports a failure through
func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Fail(t, failureMessage, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L145-L150 | go | train | // Falsef asserts that the specified value is false.
//
// assert.Falsef(t, myBool, "error message %s", "formatted") | func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool | // Falsef asserts that the specified value is false.
//
// assert.Falsef(t, myBool, "error message %s", "formatted")
func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return False(t, value, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L153-L158 | go | train | // 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 the file. | func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool | // 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 the file.
func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return FileExists(t, path, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L165-L170 | go | train | // Greaterf asserts that the first element is greater than the second
//
// assert.Greaterf(t, 2, 1, "error message %s", "formatted")
// assert.Greaterf(t, float64(2, "error message %s", "formatted"), float64(1))
// assert.Greaterf(t, "b", "a", "error message %s", "formatted") | func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool | // Greaterf asserts that the first element is greater than the second
//
// assert.Greaterf(t, 2, 1, "error message %s", "formatted")
// assert.Greaterf(t, float64(2, "error message %s", "formatted"), float64(1))
// assert.Greaterf(t, "b", "a", "error message %s", "formatted")
func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Greater(t, e1, e2, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L178-L183 | go | train | // GreaterOrEqualf asserts that the first element in greater or equal than the second
//
// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted") | func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool | // GreaterOrEqualf asserts that the first element in greater or equal than the second
//
// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted")
func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return GreaterOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L191-L196 | go | train | // HTTPBodyContainsf asserts that a specified handler returns a
// body that contains a string.
//
// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false). | func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool | // HTTPBodyContainsf asserts that a specified handler returns a
// body that contains a string.
//
// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L240-L245 | go | train | // HTTPSuccessf asserts that a specified handler returns a success status code.
//
// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false). | func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool | // HTTPSuccessf asserts that a specified handler returns a success status code.
//
// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L250-L255 | go | train | // Implementsf asserts that an object is implemented by the specified interface.
//
// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject)) | func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool | // Implementsf asserts that an object is implemented by the specified interface.
//
// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L260-L265 | go | train | // InDeltaf asserts that the two numerals are within delta of each other.
//
// assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01) | func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool | // InDeltaf asserts that the two numerals are within delta of each other.
//
// assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L268-L273 | go | train | // InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. | func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool | // InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L276-L281 | go | train | // InDeltaSlicef is the same as InDelta, except it compares two slices. | func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool | // InDeltaSlicef is the same as InDelta, except it compares two slices.
func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L284-L289 | go | train | // InEpsilonf asserts that expected and actual have a relative error less than epsilon | func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool | // InEpsilonf asserts that expected and actual have a relative error less than epsilon
func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L292-L297 | go | train | // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. | func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool | // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L300-L305 | go | train | // IsTypef asserts that the specified objects are of the same type. | func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool | // IsTypef asserts that the specified objects are of the same type.
func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L310-L315 | go | train | // JSONEqf asserts that two JSON strings are equivalent.
//
// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") | func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool | // JSONEqf asserts that two JSON strings are equivalent.
//
// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L321-L326 | go | train | // 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, 3, "error message %s", "formatted") | func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool | // 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, 3, "error message %s", "formatted")
func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Len(t, object, length, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L333-L338 | go | train | // Lessf asserts that the first element in less than the second
//
// assert.Lessf(t, 1, 2, "error message %s", "formatted")
// assert.Lessf(t, float64(1, "error message %s", "formatted"), float64(2))
// assert.Lessf(t, "a", "b", "error message %s", "formatted") | func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool | // Lessf asserts that the first element in less than the second
//
// assert.Lessf(t, 1, 2, "error message %s", "formatted")
// assert.Lessf(t, float64(1, "error message %s", "formatted"), float64(2))
// assert.Lessf(t, "a", "b", "error message %s", "formatted")
func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Less(t, e1, e2, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L346-L351 | go | train | // LessOrEqualf asserts that the first element in greater or equal than the second
//
// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted")
// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted")
// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted")
// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted") | func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool | // LessOrEqualf asserts that the first element in greater or equal than the second
//
// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted")
// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted")
// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted")
// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted")
func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L356-L361 | go | train | // Nilf asserts that the specified object is nil.
//
// assert.Nilf(t, err, "error message %s", "formatted") | func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool | // Nilf asserts that the specified object is nil.
//
// assert.Nilf(t, err, "error message %s", "formatted")
func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Nil(t, object, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L369-L374 | go | train | // NoErrorf asserts that a function returned no error (i.e. `nil`).
//
// actualObj, err := SomeFunction()
// if assert.NoErrorf(t, err, "error message %s", "formatted") {
// assert.Equal(t, expectedObj, actualObj)
// } | func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool | // NoErrorf asserts that a function returned no error (i.e. `nil`).
//
// actualObj, err := SomeFunction()
// if assert.NoErrorf(t, err, "error message %s", "formatted") {
// assert.Equal(t, expectedObj, actualObj)
// }
func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return NoError(t, err, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L382-L387 | go | train | // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted") | func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool | // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return NotContains(t, s, contains, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L395-L400 | go | train | // 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.NotEmptyf(t, obj, "error message %s", "formatted") {
// assert.Equal(t, "two", obj[1])
// } | func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool | // 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.NotEmptyf(t, obj, "error message %s", "formatted") {
// assert.Equal(t, "two", obj[1])
// }
func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return NotEmpty(t, object, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L408-L413 | go | train | // NotEqualf asserts that the specified values are NOT equal.
//
// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). | func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool | // NotEqualf asserts that the specified values are NOT equal.
//
// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L418-L423 | go | train | // NotNilf asserts that the specified object is not nil.
//
// assert.NotNilf(t, err, "error message %s", "formatted") | func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool | // NotNilf asserts that the specified object is not nil.
//
// assert.NotNilf(t, err, "error message %s", "formatted")
func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return NotNil(t, object, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L428-L433 | go | train | // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
//
// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") | func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool | // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
//
// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return NotPanics(t, f, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L439-L444 | go | train | // NotRegexpf asserts that a specified regexp does not match a string.
//
// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") | func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool | // NotRegexpf asserts that a specified regexp does not match a string.
//
// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L450-L455 | go | train | // NotSubsetf asserts that the specified list(array, slice...) contains not all
// elements given in the specified subset(array, slice...).
//
// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") | func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool | // NotSubsetf asserts that the specified list(array, slice...) contains not all
// elements given in the specified subset(array, slice...).
//
// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L458-L463 | go | train | // NotZerof asserts that i is not the zero value for its type. | func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool | // NotZerof asserts that i is not the zero value for its type.
func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return NotZero(t, i, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L468-L473 | go | train | // Panicsf asserts that the code inside the specified PanicTestFunc panics.
//
// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted") | func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool | // Panicsf asserts that the code inside the specified PanicTestFunc panics.
//
// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Panics(t, f, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L479-L484 | go | train | // PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
// the recovered panic value equals the expected panic value.
//
// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") | func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool | // PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
// the recovered panic value equals the expected panic value.
//
// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L490-L495 | go | train | // Regexpf asserts that a specified regexp matches a string.
//
// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted") | func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool | // Regexpf asserts that a specified regexp matches a string.
//
// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Regexp(t, rx, str, append([]interface{}{msg}, args...)...)
} |
stretchr/testify | 34c6fa2dc70986bccbbffcc6130f6920a924b075 | assert/assertion_format.go | https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L503-L508 | go | train | // Samef asserts that two pointers reference the same object.
//
// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted")
//
// Both arguments must be pointer variables. Pointer variable sameness is
// determined based on the equality of both type and value. | func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool | // Samef asserts that two pointers reference the same object.
//
// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted")
//
// Both arguments must be pointer variables. Pointer variable sameness is
// determined based on the equality of both type and value.
func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool | {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return Same(t, expected, actual, append([]interface{}{msg}, args...)...)
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.