assertion_format.go raw

   1  // Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT.
   2  
   3  package assert
   4  
   5  import (
   6  	http "net/http"
   7  	url "net/url"
   8  	time "time"
   9  )
  10  
  11  // Conditionf uses a Comparison to assert a complex condition.
  12  func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {
  13  	if h, ok := t.(tHelper); ok {
  14  		h.Helper()
  15  	}
  16  	return Condition(t, comp, append([]interface{}{msg}, args...)...)
  17  }
  18  
  19  // Containsf asserts that the specified string, list(array, slice...) or map contains the
  20  // specified substring or element.
  21  //
  22  //	assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
  23  //	assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
  24  //	assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
  25  func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
  26  	if h, ok := t.(tHelper); ok {
  27  		h.Helper()
  28  	}
  29  	return Contains(t, s, contains, append([]interface{}{msg}, args...)...)
  30  }
  31  
  32  // DirExistsf checks whether a directory exists in the given path. It also fails
  33  // if the path is a file rather a directory or there is an error checking whether it exists.
  34  func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
  35  	if h, ok := t.(tHelper); ok {
  36  		h.Helper()
  37  	}
  38  	return DirExists(t, path, append([]interface{}{msg}, args...)...)
  39  }
  40  
  41  // ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
  42  // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
  43  // the number of appearances of each of them in both lists should match.
  44  //
  45  // assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
  46  func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
  47  	if h, ok := t.(tHelper); ok {
  48  		h.Helper()
  49  	}
  50  	return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)
  51  }
  52  
  53  // Emptyf asserts that the given value is "empty".
  54  //
  55  // [Zero values] are "empty".
  56  //
  57  // Arrays are "empty" if every element is the zero value of the type (stricter than "empty").
  58  //
  59  // Slices, maps and channels with zero length are "empty".
  60  //
  61  // Pointer values are "empty" if the pointer is nil or if the pointed value is "empty".
  62  //
  63  //	assert.Emptyf(t, obj, "error message %s", "formatted")
  64  //
  65  // [Zero values]: https://go.dev/ref/spec#The_zero_value
  66  func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
  67  	if h, ok := t.(tHelper); ok {
  68  		h.Helper()
  69  	}
  70  	return Empty(t, object, append([]interface{}{msg}, args...)...)
  71  }
  72  
  73  // Equalf asserts that two objects are equal.
  74  //
  75  //	assert.Equalf(t, 123, 123, "error message %s", "formatted")
  76  //
  77  // Pointer variable equality is determined based on the equality of the
  78  // referenced values (as opposed to the memory addresses). Function equality
  79  // cannot be determined and will always fail.
  80  func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
  81  	if h, ok := t.(tHelper); ok {
  82  		h.Helper()
  83  	}
  84  	return Equal(t, expected, actual, append([]interface{}{msg}, args...)...)
  85  }
  86  
  87  // EqualErrorf asserts that a function returned an error (i.e. not `nil`)
  88  // and that it is equal to the provided error.
  89  //
  90  //	actualObj, err := SomeFunction()
  91  //	assert.EqualErrorf(t, err,  expectedErrorString, "error message %s", "formatted")
  92  func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool {
  93  	if h, ok := t.(tHelper); ok {
  94  		h.Helper()
  95  	}
  96  	return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)
  97  }
  98  
  99  // EqualExportedValuesf asserts that the types of two objects are equal and their public
 100  // fields are also equal. This is useful for comparing structs that have private fields
 101  // that could potentially differ.
 102  //
 103  //	 type S struct {
 104  //		Exported     	int
 105  //		notExported   	int
 106  //	 }
 107  //	 assert.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, "error message %s", "formatted") => true
 108  //	 assert.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, "error message %s", "formatted") => false
 109  func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 110  	if h, ok := t.(tHelper); ok {
 111  		h.Helper()
 112  	}
 113  	return EqualExportedValues(t, expected, actual, append([]interface{}{msg}, args...)...)
 114  }
 115  
 116  // EqualValuesf asserts that two objects are equal or convertible to the larger
 117  // type and equal.
 118  //
 119  //	assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted")
 120  func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 121  	if h, ok := t.(tHelper); ok {
 122  		h.Helper()
 123  	}
 124  	return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
 125  }
 126  
 127  // Errorf asserts that a function returned an error (i.e. not `nil`).
 128  //
 129  //	actualObj, err := SomeFunction()
 130  //	assert.Errorf(t, err, "error message %s", "formatted")
 131  func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
 132  	if h, ok := t.(tHelper); ok {
 133  		h.Helper()
 134  	}
 135  	return Error(t, err, append([]interface{}{msg}, args...)...)
 136  }
 137  
 138  // ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
 139  // This is a wrapper for errors.As.
 140  func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool {
 141  	if h, ok := t.(tHelper); ok {
 142  		h.Helper()
 143  	}
 144  	return ErrorAs(t, err, target, append([]interface{}{msg}, args...)...)
 145  }
 146  
 147  // ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
 148  // and that the error contains the specified substring.
 149  //
 150  //	actualObj, err := SomeFunction()
 151  //	assert.ErrorContainsf(t, err,  expectedErrorSubString, "error message %s", "formatted")
 152  func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) bool {
 153  	if h, ok := t.(tHelper); ok {
 154  		h.Helper()
 155  	}
 156  	return ErrorContains(t, theError, contains, append([]interface{}{msg}, args...)...)
 157  }
 158  
 159  // ErrorIsf asserts that at least one of the errors in err's chain matches target.
 160  // This is a wrapper for errors.Is.
 161  func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {
 162  	if h, ok := t.(tHelper); ok {
 163  		h.Helper()
 164  	}
 165  	return ErrorIs(t, err, target, append([]interface{}{msg}, args...)...)
 166  }
 167  
 168  // Eventuallyf asserts that given condition will be met in waitFor time,
 169  // periodically checking target function each tick.
 170  //
 171  //	assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
 172  func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
 173  	if h, ok := t.(tHelper); ok {
 174  		h.Helper()
 175  	}
 176  	return Eventually(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
 177  }
 178  
 179  // EventuallyWithTf asserts that given condition will be met in waitFor time,
 180  // periodically checking target function each tick. In contrast to Eventually,
 181  // it supplies a CollectT to the condition function, so that the condition
 182  // function can use the CollectT to call other assertions.
 183  // The condition is considered "met" if no errors are raised in a tick.
 184  // The supplied CollectT collects all errors from one tick (if there are any).
 185  // If the condition is not met before waitFor, the collected errors of
 186  // the last tick are copied to t.
 187  //
 188  //	externalValue := false
 189  //	go func() {
 190  //		time.Sleep(8*time.Second)
 191  //		externalValue = true
 192  //	}()
 193  //	assert.EventuallyWithTf(t, func(c *assert.CollectT, "error message %s", "formatted") {
 194  //		// add assertions as needed; any assertion failure will fail the current tick
 195  //		assert.True(c, externalValue, "expected 'externalValue' to be true")
 196  //	}, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
 197  func EventuallyWithTf(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
 198  	if h, ok := t.(tHelper); ok {
 199  		h.Helper()
 200  	}
 201  	return EventuallyWithT(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
 202  }
 203  
 204  // Exactlyf asserts that two objects are equal in value and type.
 205  //
 206  //	assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted")
 207  func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 208  	if h, ok := t.(tHelper); ok {
 209  		h.Helper()
 210  	}
 211  	return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)
 212  }
 213  
 214  // Failf reports a failure through
 215  func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
 216  	if h, ok := t.(tHelper); ok {
 217  		h.Helper()
 218  	}
 219  	return Fail(t, failureMessage, append([]interface{}{msg}, args...)...)
 220  }
 221  
 222  // FailNowf fails test
 223  func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
 224  	if h, ok := t.(tHelper); ok {
 225  		h.Helper()
 226  	}
 227  	return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...)
 228  }
 229  
 230  // Falsef asserts that the specified value is false.
 231  //
 232  //	assert.Falsef(t, myBool, "error message %s", "formatted")
 233  func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {
 234  	if h, ok := t.(tHelper); ok {
 235  		h.Helper()
 236  	}
 237  	return False(t, value, append([]interface{}{msg}, args...)...)
 238  }
 239  
 240  // FileExistsf checks whether a file exists in the given path. It also fails if
 241  // the path points to a directory or there is an error when trying to check the file.
 242  func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
 243  	if h, ok := t.(tHelper); ok {
 244  		h.Helper()
 245  	}
 246  	return FileExists(t, path, append([]interface{}{msg}, args...)...)
 247  }
 248  
 249  // Greaterf asserts that the first element is greater than the second
 250  //
 251  //	assert.Greaterf(t, 2, 1, "error message %s", "formatted")
 252  //	assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted")
 253  //	assert.Greaterf(t, "b", "a", "error message %s", "formatted")
 254  func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
 255  	if h, ok := t.(tHelper); ok {
 256  		h.Helper()
 257  	}
 258  	return Greater(t, e1, e2, append([]interface{}{msg}, args...)...)
 259  }
 260  
 261  // GreaterOrEqualf asserts that the first element is greater than or equal to the second
 262  //
 263  //	assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
 264  //	assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
 265  //	assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
 266  //	assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted")
 267  func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
 268  	if h, ok := t.(tHelper); ok {
 269  		h.Helper()
 270  	}
 271  	return GreaterOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
 272  }
 273  
 274  // HTTPBodyContainsf asserts that a specified handler returns a
 275  // body that contains a string.
 276  //
 277  //	assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
 278  //
 279  // Returns whether the assertion was successful (true) or not (false).
 280  func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
 281  	if h, ok := t.(tHelper); ok {
 282  		h.Helper()
 283  	}
 284  	return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
 285  }
 286  
 287  // HTTPBodyNotContainsf asserts that a specified handler returns a
 288  // body that does not contain a string.
 289  //
 290  //	assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
 291  //
 292  // Returns whether the assertion was successful (true) or not (false).
 293  func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
 294  	if h, ok := t.(tHelper); ok {
 295  		h.Helper()
 296  	}
 297  	return HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
 298  }
 299  
 300  // HTTPErrorf asserts that a specified handler returns an error status code.
 301  //
 302  //	assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
 303  //
 304  // Returns whether the assertion was successful (true) or not (false).
 305  func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
 306  	if h, ok := t.(tHelper); ok {
 307  		h.Helper()
 308  	}
 309  	return HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
 310  }
 311  
 312  // HTTPRedirectf asserts that a specified handler returns a redirect status code.
 313  //
 314  //	assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
 315  //
 316  // Returns whether the assertion was successful (true) or not (false).
 317  func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
 318  	if h, ok := t.(tHelper); ok {
 319  		h.Helper()
 320  	}
 321  	return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
 322  }
 323  
 324  // HTTPStatusCodef asserts that a specified handler returns a specified status code.
 325  //
 326  //	assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
 327  //
 328  // Returns whether the assertion was successful (true) or not (false).
 329  func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool {
 330  	if h, ok := t.(tHelper); ok {
 331  		h.Helper()
 332  	}
 333  	return HTTPStatusCode(t, handler, method, url, values, statuscode, append([]interface{}{msg}, args...)...)
 334  }
 335  
 336  // HTTPSuccessf asserts that a specified handler returns a success status code.
 337  //
 338  //	assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
 339  //
 340  // Returns whether the assertion was successful (true) or not (false).
 341  func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
 342  	if h, ok := t.(tHelper); ok {
 343  		h.Helper()
 344  	}
 345  	return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
 346  }
 347  
 348  // Implementsf asserts that an object is implemented by the specified interface.
 349  //
 350  //	assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
 351  func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
 352  	if h, ok := t.(tHelper); ok {
 353  		h.Helper()
 354  	}
 355  	return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)
 356  }
 357  
 358  // InDeltaf asserts that the two numerals are within delta of each other.
 359  //
 360  //	assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
 361  func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
 362  	if h, ok := t.(tHelper); ok {
 363  		h.Helper()
 364  	}
 365  	return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
 366  }
 367  
 368  // InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
 369  func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
 370  	if h, ok := t.(tHelper); ok {
 371  		h.Helper()
 372  	}
 373  	return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
 374  }
 375  
 376  // InDeltaSlicef is the same as InDelta, except it compares two slices.
 377  func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
 378  	if h, ok := t.(tHelper); ok {
 379  		h.Helper()
 380  	}
 381  	return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
 382  }
 383  
 384  // InEpsilonf asserts that expected and actual have a relative error less than epsilon
 385  func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
 386  	if h, ok := t.(tHelper); ok {
 387  		h.Helper()
 388  	}
 389  	return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
 390  }
 391  
 392  // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
 393  func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
 394  	if h, ok := t.(tHelper); ok {
 395  		h.Helper()
 396  	}
 397  	return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
 398  }
 399  
 400  // IsDecreasingf asserts that the collection is decreasing
 401  //
 402  //	assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted")
 403  //	assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted")
 404  //	assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
 405  func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
 406  	if h, ok := t.(tHelper); ok {
 407  		h.Helper()
 408  	}
 409  	return IsDecreasing(t, object, append([]interface{}{msg}, args...)...)
 410  }
 411  
 412  // IsIncreasingf asserts that the collection is increasing
 413  //
 414  //	assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted")
 415  //	assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted")
 416  //	assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
 417  func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
 418  	if h, ok := t.(tHelper); ok {
 419  		h.Helper()
 420  	}
 421  	return IsIncreasing(t, object, append([]interface{}{msg}, args...)...)
 422  }
 423  
 424  // IsNonDecreasingf asserts that the collection is not decreasing
 425  //
 426  //	assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted")
 427  //	assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted")
 428  //	assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
 429  func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
 430  	if h, ok := t.(tHelper); ok {
 431  		h.Helper()
 432  	}
 433  	return IsNonDecreasing(t, object, append([]interface{}{msg}, args...)...)
 434  }
 435  
 436  // IsNonIncreasingf asserts that the collection is not increasing
 437  //
 438  //	assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted")
 439  //	assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted")
 440  //	assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
 441  func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
 442  	if h, ok := t.(tHelper); ok {
 443  		h.Helper()
 444  	}
 445  	return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...)
 446  }
 447  
 448  // IsNotTypef asserts that the specified objects are not of the same type.
 449  //
 450  //	assert.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, "error message %s", "formatted")
 451  func IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) bool {
 452  	if h, ok := t.(tHelper); ok {
 453  		h.Helper()
 454  	}
 455  	return IsNotType(t, theType, object, append([]interface{}{msg}, args...)...)
 456  }
 457  
 458  // IsTypef asserts that the specified objects are of the same type.
 459  //
 460  //	assert.IsTypef(t, &MyStruct{}, &MyStruct{}, "error message %s", "formatted")
 461  func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
 462  	if h, ok := t.(tHelper); ok {
 463  		h.Helper()
 464  	}
 465  	return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)
 466  }
 467  
 468  // JSONEqf asserts that two JSON strings are equivalent.
 469  //
 470  //	assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
 471  func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
 472  	if h, ok := t.(tHelper); ok {
 473  		h.Helper()
 474  	}
 475  	return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)
 476  }
 477  
 478  // Lenf asserts that the specified object has specific length.
 479  // Lenf also fails if the object has a type that len() not accept.
 480  //
 481  //	assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
 482  func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {
 483  	if h, ok := t.(tHelper); ok {
 484  		h.Helper()
 485  	}
 486  	return Len(t, object, length, append([]interface{}{msg}, args...)...)
 487  }
 488  
 489  // Lessf asserts that the first element is less than the second
 490  //
 491  //	assert.Lessf(t, 1, 2, "error message %s", "formatted")
 492  //	assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted")
 493  //	assert.Lessf(t, "a", "b", "error message %s", "formatted")
 494  func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
 495  	if h, ok := t.(tHelper); ok {
 496  		h.Helper()
 497  	}
 498  	return Less(t, e1, e2, append([]interface{}{msg}, args...)...)
 499  }
 500  
 501  // LessOrEqualf asserts that the first element is less than or equal to the second
 502  //
 503  //	assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted")
 504  //	assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted")
 505  //	assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted")
 506  //	assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted")
 507  func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
 508  	if h, ok := t.(tHelper); ok {
 509  		h.Helper()
 510  	}
 511  	return LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
 512  }
 513  
 514  // Negativef asserts that the specified element is negative
 515  //
 516  //	assert.Negativef(t, -1, "error message %s", "formatted")
 517  //	assert.Negativef(t, -1.23, "error message %s", "formatted")
 518  func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool {
 519  	if h, ok := t.(tHelper); ok {
 520  		h.Helper()
 521  	}
 522  	return Negative(t, e, append([]interface{}{msg}, args...)...)
 523  }
 524  
 525  // Neverf asserts that the given condition doesn't satisfy in waitFor time,
 526  // periodically checking the target function each tick.
 527  //
 528  //	assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
 529  func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
 530  	if h, ok := t.(tHelper); ok {
 531  		h.Helper()
 532  	}
 533  	return Never(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
 534  }
 535  
 536  // Nilf asserts that the specified object is nil.
 537  //
 538  //	assert.Nilf(t, err, "error message %s", "formatted")
 539  func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
 540  	if h, ok := t.(tHelper); ok {
 541  		h.Helper()
 542  	}
 543  	return Nil(t, object, append([]interface{}{msg}, args...)...)
 544  }
 545  
 546  // NoDirExistsf checks whether a directory does not exist in the given path.
 547  // It fails if the path points to an existing _directory_ only.
 548  func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
 549  	if h, ok := t.(tHelper); ok {
 550  		h.Helper()
 551  	}
 552  	return NoDirExists(t, path, append([]interface{}{msg}, args...)...)
 553  }
 554  
 555  // NoErrorf asserts that a function returned no error (i.e. `nil`).
 556  //
 557  //	  actualObj, err := SomeFunction()
 558  //	  if assert.NoErrorf(t, err, "error message %s", "formatted") {
 559  //		   assert.Equal(t, expectedObj, actualObj)
 560  //	  }
 561  func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {
 562  	if h, ok := t.(tHelper); ok {
 563  		h.Helper()
 564  	}
 565  	return NoError(t, err, append([]interface{}{msg}, args...)...)
 566  }
 567  
 568  // NoFileExistsf checks whether a file does not exist in a given path. It fails
 569  // if the path points to an existing _file_ only.
 570  func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
 571  	if h, ok := t.(tHelper); ok {
 572  		h.Helper()
 573  	}
 574  	return NoFileExists(t, path, append([]interface{}{msg}, args...)...)
 575  }
 576  
 577  // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
 578  // specified substring or element.
 579  //
 580  //	assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
 581  //	assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
 582  //	assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
 583  func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
 584  	if h, ok := t.(tHelper); ok {
 585  		h.Helper()
 586  	}
 587  	return NotContains(t, s, contains, append([]interface{}{msg}, args...)...)
 588  }
 589  
 590  // NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified
 591  // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
 592  // the number of appearances of each of them in both lists should not match.
 593  // This is an inverse of ElementsMatch.
 594  //
 595  // assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false
 596  //
 597  // assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true
 598  //
 599  // assert.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true
 600  func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
 601  	if h, ok := t.(tHelper); ok {
 602  		h.Helper()
 603  	}
 604  	return NotElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)
 605  }
 606  
 607  // NotEmptyf asserts that the specified object is NOT [Empty].
 608  //
 609  //	if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
 610  //	  assert.Equal(t, "two", obj[1])
 611  //	}
 612  func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
 613  	if h, ok := t.(tHelper); ok {
 614  		h.Helper()
 615  	}
 616  	return NotEmpty(t, object, append([]interface{}{msg}, args...)...)
 617  }
 618  
 619  // NotEqualf asserts that the specified values are NOT equal.
 620  //
 621  //	assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
 622  //
 623  // Pointer variable equality is determined based on the equality of the
 624  // referenced values (as opposed to the memory addresses).
 625  func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 626  	if h, ok := t.(tHelper); ok {
 627  		h.Helper()
 628  	}
 629  	return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)
 630  }
 631  
 632  // NotEqualValuesf asserts that two objects are not equal even when converted to the same type
 633  //
 634  //	assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted")
 635  func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 636  	if h, ok := t.(tHelper); ok {
 637  		h.Helper()
 638  	}
 639  	return NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
 640  }
 641  
 642  // NotErrorAsf asserts that none of the errors in err's chain matches target,
 643  // but if so, sets target to that error value.
 644  func NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool {
 645  	if h, ok := t.(tHelper); ok {
 646  		h.Helper()
 647  	}
 648  	return NotErrorAs(t, err, target, append([]interface{}{msg}, args...)...)
 649  }
 650  
 651  // NotErrorIsf asserts that none of the errors in err's chain matches target.
 652  // This is a wrapper for errors.Is.
 653  func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {
 654  	if h, ok := t.(tHelper); ok {
 655  		h.Helper()
 656  	}
 657  	return NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...)
 658  }
 659  
 660  // NotImplementsf asserts that an object does not implement the specified interface.
 661  //
 662  //	assert.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
 663  func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
 664  	if h, ok := t.(tHelper); ok {
 665  		h.Helper()
 666  	}
 667  	return NotImplements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)
 668  }
 669  
 670  // NotNilf asserts that the specified object is not nil.
 671  //
 672  //	assert.NotNilf(t, err, "error message %s", "formatted")
 673  func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
 674  	if h, ok := t.(tHelper); ok {
 675  		h.Helper()
 676  	}
 677  	return NotNil(t, object, append([]interface{}{msg}, args...)...)
 678  }
 679  
 680  // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
 681  //
 682  //	assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
 683  func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
 684  	if h, ok := t.(tHelper); ok {
 685  		h.Helper()
 686  	}
 687  	return NotPanics(t, f, append([]interface{}{msg}, args...)...)
 688  }
 689  
 690  // NotRegexpf asserts that a specified regexp does not match a string.
 691  //
 692  //	assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
 693  //	assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
 694  func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
 695  	if h, ok := t.(tHelper); ok {
 696  		h.Helper()
 697  	}
 698  	return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)
 699  }
 700  
 701  // NotSamef asserts that two pointers do not reference the same object.
 702  //
 703  //	assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted")
 704  //
 705  // Both arguments must be pointer variables. Pointer variable sameness is
 706  // determined based on the equality of both type and value.
 707  func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 708  	if h, ok := t.(tHelper); ok {
 709  		h.Helper()
 710  	}
 711  	return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...)
 712  }
 713  
 714  // NotSubsetf asserts that the list (array, slice, or map) does NOT contain all
 715  // elements given in the subset (array, slice, or map).
 716  // Map elements are key-value pairs unless compared with an array or slice where
 717  // only the map key is evaluated.
 718  //
 719  //	assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted")
 720  //	assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted")
 721  //	assert.NotSubsetf(t, [1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted")
 722  //	assert.NotSubsetf(t, {"x": 1, "y": 2}, ["z"], "error message %s", "formatted")
 723  func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
 724  	if h, ok := t.(tHelper); ok {
 725  		h.Helper()
 726  	}
 727  	return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)
 728  }
 729  
 730  // NotZerof asserts that i is not the zero value for its type.
 731  func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
 732  	if h, ok := t.(tHelper); ok {
 733  		h.Helper()
 734  	}
 735  	return NotZero(t, i, append([]interface{}{msg}, args...)...)
 736  }
 737  
 738  // Panicsf asserts that the code inside the specified PanicTestFunc panics.
 739  //
 740  //	assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
 741  func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
 742  	if h, ok := t.(tHelper); ok {
 743  		h.Helper()
 744  	}
 745  	return Panics(t, f, append([]interface{}{msg}, args...)...)
 746  }
 747  
 748  // PanicsWithErrorf asserts that the code inside the specified PanicTestFunc
 749  // panics, and that the recovered panic value is an error that satisfies the
 750  // EqualError comparison.
 751  //
 752  //	assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
 753  func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string, args ...interface{}) bool {
 754  	if h, ok := t.(tHelper); ok {
 755  		h.Helper()
 756  	}
 757  	return PanicsWithError(t, errString, f, append([]interface{}{msg}, args...)...)
 758  }
 759  
 760  // PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
 761  // the recovered panic value equals the expected panic value.
 762  //
 763  //	assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
 764  func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
 765  	if h, ok := t.(tHelper); ok {
 766  		h.Helper()
 767  	}
 768  	return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)
 769  }
 770  
 771  // Positivef asserts that the specified element is positive
 772  //
 773  //	assert.Positivef(t, 1, "error message %s", "formatted")
 774  //	assert.Positivef(t, 1.23, "error message %s", "formatted")
 775  func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool {
 776  	if h, ok := t.(tHelper); ok {
 777  		h.Helper()
 778  	}
 779  	return Positive(t, e, append([]interface{}{msg}, args...)...)
 780  }
 781  
 782  // Regexpf asserts that a specified regexp matches a string.
 783  //
 784  //	assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
 785  //	assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
 786  func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
 787  	if h, ok := t.(tHelper); ok {
 788  		h.Helper()
 789  	}
 790  	return Regexp(t, rx, str, append([]interface{}{msg}, args...)...)
 791  }
 792  
 793  // Samef asserts that two pointers reference the same object.
 794  //
 795  //	assert.Samef(t, ptr1, ptr2, "error message %s", "formatted")
 796  //
 797  // Both arguments must be pointer variables. Pointer variable sameness is
 798  // determined based on the equality of both type and value.
 799  func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 800  	if h, ok := t.(tHelper); ok {
 801  		h.Helper()
 802  	}
 803  	return Same(t, expected, actual, append([]interface{}{msg}, args...)...)
 804  }
 805  
 806  // Subsetf asserts that the list (array, slice, or map) contains all elements
 807  // given in the subset (array, slice, or map).
 808  // Map elements are key-value pairs unless compared with an array or slice where
 809  // only the map key is evaluated.
 810  //
 811  //	assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted")
 812  //	assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted")
 813  //	assert.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted")
 814  //	assert.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted")
 815  func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
 816  	if h, ok := t.(tHelper); ok {
 817  		h.Helper()
 818  	}
 819  	return Subset(t, list, subset, append([]interface{}{msg}, args...)...)
 820  }
 821  
 822  // Truef asserts that the specified value is true.
 823  //
 824  //	assert.Truef(t, myBool, "error message %s", "formatted")
 825  func Truef(t TestingT, value bool, msg string, args ...interface{}) bool {
 826  	if h, ok := t.(tHelper); ok {
 827  		h.Helper()
 828  	}
 829  	return True(t, value, append([]interface{}{msg}, args...)...)
 830  }
 831  
 832  // WithinDurationf asserts that the two times are within duration delta of each other.
 833  //
 834  //	assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
 835  func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
 836  	if h, ok := t.(tHelper); ok {
 837  		h.Helper()
 838  	}
 839  	return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
 840  }
 841  
 842  // WithinRangef asserts that a time is within a time range (inclusive).
 843  //
 844  //	assert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted")
 845  func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {
 846  	if h, ok := t.(tHelper); ok {
 847  		h.Helper()
 848  	}
 849  	return WithinRange(t, actual, start, end, append([]interface{}{msg}, args...)...)
 850  }
 851  
 852  // YAMLEqf asserts that two YAML strings are equivalent.
 853  func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
 854  	if h, ok := t.(tHelper); ok {
 855  		h.Helper()
 856  	}
 857  	return YAMLEq(t, expected, actual, append([]interface{}{msg}, args...)...)
 858  }
 859  
 860  // Zerof asserts that i is the zero value for its type.
 861  func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
 862  	if h, ok := t.(tHelper); ok {
 863  		h.Helper()
 864  	}
 865  	return Zero(t, i, append([]interface{}{msg}, args...)...)
 866  }
 867