1575 lines · 46.4 KB · Go
RawDownload
/** CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen* THIS FILE MUST NOT BE EDITED BY HAND */ package require import (	assert "github.com/stretchr/testify/assert"	http "net/http"	url "net/url"	time "time") // Condition uses a Comparison to assert a complex condition.func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Condition(t, comp, msgAndArgs...) {		return	}	t.FailNow()} // Conditionf uses a Comparison to assert a complex condition.func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Conditionf(t, comp, msg, args...) {		return	}	t.FailNow()} // Contains asserts that the specified string, list(array, slice...) or map contains the// specified substring or element.////    assert.Contains(t, "Hello World", "World")//    assert.Contains(t, ["Hello", "World"], "World")//    assert.Contains(t, {"Hello": "World"}, "Hello")func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Contains(t, s, contains, msgAndArgs...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Containsf(t, s, contains, msg, args...) {		return	}	t.FailNow()} // DirExists checks whether a directory exists in the given path. It also fails// if the path is a file rather a directory or there is an error checking whether it exists.func DirExists(t TestingT, path string, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.DirExists(t, path, msgAndArgs...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.DirExistsf(t, path, msg, args...) {		return	}	t.FailNow()} // ElementsMatch 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.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.ElementsMatch(t, listA, listB, msgAndArgs...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.ElementsMatchf(t, listA, listB, msg, args...) {		return	}	t.FailNow()} // Empty asserts that the specified object is empty.  I.e. nil, "", false, 0 or either// a slice or a channel with len == 0.////  assert.Empty(t, obj)func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Empty(t, object, msgAndArgs...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Emptyf(t, object, msg, args...) {		return	}	t.FailNow()} // Equal asserts that two objects are equal.////    assert.Equal(t, 123, 123)//// 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 Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Equal(t, expected, actual, msgAndArgs...) {		return	}	t.FailNow()} // EqualError asserts that a function returned an error (i.e. not `nil`)// and that it is equal to the provided error.////   actualObj, err := SomeFunction()//   assert.EqualError(t, err,  expectedErrorString)func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.EqualError(t, theError, errString, msgAndArgs...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.EqualErrorf(t, theError, errString, msg, args...) {		return	}	t.FailNow()} // EqualValues asserts that two objects are equal or convertable to the same types// and equal.////    assert.EqualValues(t, uint32(123), int32(123))func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.EqualValues(t, expected, actual, msgAndArgs...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.EqualValuesf(t, expected, actual, msg, args...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Equalf(t, expected, actual, msg, args...) {		return	}	t.FailNow()} // Error asserts that a function returned an error (i.e. not `nil`).////   actualObj, err := SomeFunction()//   if assert.Error(t, err) {// 	   assert.Equal(t, expectedError, err)//   }func Error(t TestingT, err error, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Error(t, err, msgAndArgs...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Errorf(t, err, msg, args...) {		return	}	t.FailNow()} // Eventually asserts that given condition will be met in waitFor time,// periodically checking target function each tick.////    assert.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond)func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Eventually(t, condition, waitFor, tick, msgAndArgs...) {		return	}	t.FailNow()} // Eventuallyf asserts that given condition will be met in waitFor time,// periodically checking target function each tick.////    assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Eventuallyf(t, condition, waitFor, tick, msg, args...) {		return	}	t.FailNow()} // Exactly asserts that two objects are equal in value and type.////    assert.Exactly(t, int32(123), int64(123))func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Exactly(t, expected, actual, msgAndArgs...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Exactlyf(t, expected, actual, msg, args...) {		return	}	t.FailNow()} // Fail reports a failure throughfunc Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Fail(t, failureMessage, msgAndArgs...) {		return	}	t.FailNow()} // FailNow fails testfunc FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.FailNow(t, failureMessage, msgAndArgs...) {		return	}	t.FailNow()} // FailNowf fails testfunc FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.FailNowf(t, failureMessage, msg, args...) {		return	}	t.FailNow()} // Failf reports a failure throughfunc Failf(t TestingT, failureMessage string, msg string, args ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Failf(t, failureMessage, msg, args...) {		return	}	t.FailNow()} // False asserts that the specified value is false.////    assert.False(t, myBool)func False(t TestingT, value bool, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.False(t, value, msgAndArgs...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Falsef(t, value, msg, args...) {		return	}	t.FailNow()} // FileExists checks whether a file exists in the given path. It also fails if// the path points to a directory or there is an error when trying to check the file.func FileExists(t TestingT, path string, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.FileExists(t, path, msgAndArgs...) {		return	}	t.FailNow()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.FileExistsf(t, path, msg, args...) {		return	}	t.FailNow()} // 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()} // GreaterOrEqual asserts that the first element is greater than or equal to the second////    assert.GreaterOrEqual(t, 2, 1)//    assert.GreaterOrEqual(t, 2, 2)//    assert.GreaterOrEqual(t, "b", "a")//    assert.GreaterOrEqual(t, "b", "b")func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.GreaterOrEqual(t, e1, e2, msgAndArgs...) {		return	}	t.FailNow()} // GreaterOrEqualf asserts that the first element is greater than or equal to 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()} // 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{}) {	if h, ok := t.(tHelper); ok {		h.Helper()	}	if assert.Greaterf(t, e1, e2, msg, args...) {		return	}	t.FailNow()} // 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()} 

Lines 1–500 of 1575.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t