assertion_forward.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  // Condition uses a Comparison to assert a complex condition.
  12  func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool {
  13  	if h, ok := a.t.(tHelper); ok {
  14  		h.Helper()
  15  	}
  16  	return Condition(a.t, comp, msgAndArgs...)
  17  }
  18  
  19  // Conditionf uses a Comparison to assert a complex condition.
  20  func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool {
  21  	if h, ok := a.t.(tHelper); ok {
  22  		h.Helper()
  23  	}
  24  	return Conditionf(a.t, comp, msg, args...)
  25  }
  26  
  27  // Contains asserts that the specified string, list(array, slice...) or map contains the
  28  // specified substring or element.
  29  //
  30  //	a.Contains("Hello World", "World")
  31  //	a.Contains(["Hello", "World"], "World")
  32  //	a.Contains({"Hello": "World"}, "Hello")
  33  func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
  34  	if h, ok := a.t.(tHelper); ok {
  35  		h.Helper()
  36  	}
  37  	return Contains(a.t, s, contains, msgAndArgs...)
  38  }
  39  
  40  // Containsf asserts that the specified string, list(array, slice...) or map contains the
  41  // specified substring or element.
  42  //
  43  //	a.Containsf("Hello World", "World", "error message %s", "formatted")
  44  //	a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
  45  //	a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
  46  func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
  47  	if h, ok := a.t.(tHelper); ok {
  48  		h.Helper()
  49  	}
  50  	return Containsf(a.t, s, contains, msg, args...)
  51  }
  52  
  53  // DirExists checks whether a directory exists in the given path. It also fails
  54  // if the path is a file rather a directory or there is an error checking whether it exists.
  55  func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool {
  56  	if h, ok := a.t.(tHelper); ok {
  57  		h.Helper()
  58  	}
  59  	return DirExists(a.t, path, msgAndArgs...)
  60  }
  61  
  62  // DirExistsf checks whether a directory exists in the given path. It also fails
  63  // if the path is a file rather a directory or there is an error checking whether it exists.
  64  func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool {
  65  	if h, ok := a.t.(tHelper); ok {
  66  		h.Helper()
  67  	}
  68  	return DirExistsf(a.t, path, msg, args...)
  69  }
  70  
  71  // ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
  72  // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
  73  // the number of appearances of each of them in both lists should match.
  74  //
  75  // a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])
  76  func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool {
  77  	if h, ok := a.t.(tHelper); ok {
  78  		h.Helper()
  79  	}
  80  	return ElementsMatch(a.t, listA, listB, msgAndArgs...)
  81  }
  82  
  83  // ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
  84  // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
  85  // the number of appearances of each of them in both lists should match.
  86  //
  87  // a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
  88  func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
  89  	if h, ok := a.t.(tHelper); ok {
  90  		h.Helper()
  91  	}
  92  	return ElementsMatchf(a.t, listA, listB, msg, args...)
  93  }
  94  
  95  // Empty asserts that the given value is "empty".
  96  //
  97  // [Zero values] are "empty".
  98  //
  99  // Arrays are "empty" if every element is the zero value of the type (stricter than "empty").
 100  //
 101  // Slices, maps and channels with zero length are "empty".
 102  //
 103  // Pointer values are "empty" if the pointer is nil or if the pointed value is "empty".
 104  //
 105  //	a.Empty(obj)
 106  //
 107  // [Zero values]: https://go.dev/ref/spec#The_zero_value
 108  func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {
 109  	if h, ok := a.t.(tHelper); ok {
 110  		h.Helper()
 111  	}
 112  	return Empty(a.t, object, msgAndArgs...)
 113  }
 114  
 115  // Emptyf asserts that the given value is "empty".
 116  //
 117  // [Zero values] are "empty".
 118  //
 119  // Arrays are "empty" if every element is the zero value of the type (stricter than "empty").
 120  //
 121  // Slices, maps and channels with zero length are "empty".
 122  //
 123  // Pointer values are "empty" if the pointer is nil or if the pointed value is "empty".
 124  //
 125  //	a.Emptyf(obj, "error message %s", "formatted")
 126  //
 127  // [Zero values]: https://go.dev/ref/spec#The_zero_value
 128  func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool {
 129  	if h, ok := a.t.(tHelper); ok {
 130  		h.Helper()
 131  	}
 132  	return Emptyf(a.t, object, msg, args...)
 133  }
 134  
 135  // Equal asserts that two objects are equal.
 136  //
 137  //	a.Equal(123, 123)
 138  //
 139  // Pointer variable equality is determined based on the equality of the
 140  // referenced values (as opposed to the memory addresses). Function equality
 141  // cannot be determined and will always fail.
 142  func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
 143  	if h, ok := a.t.(tHelper); ok {
 144  		h.Helper()
 145  	}
 146  	return Equal(a.t, expected, actual, msgAndArgs...)
 147  }
 148  
 149  // EqualError asserts that a function returned an error (i.e. not `nil`)
 150  // and that it is equal to the provided error.
 151  //
 152  //	actualObj, err := SomeFunction()
 153  //	a.EqualError(err,  expectedErrorString)
 154  func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool {
 155  	if h, ok := a.t.(tHelper); ok {
 156  		h.Helper()
 157  	}
 158  	return EqualError(a.t, theError, errString, msgAndArgs...)
 159  }
 160  
 161  // EqualErrorf asserts that a function returned an error (i.e. not `nil`)
 162  // and that it is equal to the provided error.
 163  //
 164  //	actualObj, err := SomeFunction()
 165  //	a.EqualErrorf(err,  expectedErrorString, "error message %s", "formatted")
 166  func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool {
 167  	if h, ok := a.t.(tHelper); ok {
 168  		h.Helper()
 169  	}
 170  	return EqualErrorf(a.t, theError, errString, msg, args...)
 171  }
 172  
 173  // EqualExportedValues asserts that the types of two objects are equal and their public
 174  // fields are also equal. This is useful for comparing structs that have private fields
 175  // that could potentially differ.
 176  //
 177  //	 type S struct {
 178  //		Exported     	int
 179  //		notExported   	int
 180  //	 }
 181  //	 a.EqualExportedValues(S{1, 2}, S{1, 3}) => true
 182  //	 a.EqualExportedValues(S{1, 2}, S{2, 3}) => false
 183  func (a *Assertions) EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
 184  	if h, ok := a.t.(tHelper); ok {
 185  		h.Helper()
 186  	}
 187  	return EqualExportedValues(a.t, expected, actual, msgAndArgs...)
 188  }
 189  
 190  // EqualExportedValuesf asserts that the types of two objects are equal and their public
 191  // fields are also equal. This is useful for comparing structs that have private fields
 192  // that could potentially differ.
 193  //
 194  //	 type S struct {
 195  //		Exported     	int
 196  //		notExported   	int
 197  //	 }
 198  //	 a.EqualExportedValuesf(S{1, 2}, S{1, 3}, "error message %s", "formatted") => true
 199  //	 a.EqualExportedValuesf(S{1, 2}, S{2, 3}, "error message %s", "formatted") => false
 200  func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 201  	if h, ok := a.t.(tHelper); ok {
 202  		h.Helper()
 203  	}
 204  	return EqualExportedValuesf(a.t, expected, actual, msg, args...)
 205  }
 206  
 207  // EqualValues asserts that two objects are equal or convertible to the larger
 208  // type and equal.
 209  //
 210  //	a.EqualValues(uint32(123), int32(123))
 211  func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
 212  	if h, ok := a.t.(tHelper); ok {
 213  		h.Helper()
 214  	}
 215  	return EqualValues(a.t, expected, actual, msgAndArgs...)
 216  }
 217  
 218  // EqualValuesf asserts that two objects are equal or convertible to the larger
 219  // type and equal.
 220  //
 221  //	a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted")
 222  func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 223  	if h, ok := a.t.(tHelper); ok {
 224  		h.Helper()
 225  	}
 226  	return EqualValuesf(a.t, expected, actual, msg, args...)
 227  }
 228  
 229  // Equalf asserts that two objects are equal.
 230  //
 231  //	a.Equalf(123, 123, "error message %s", "formatted")
 232  //
 233  // Pointer variable equality is determined based on the equality of the
 234  // referenced values (as opposed to the memory addresses). Function equality
 235  // cannot be determined and will always fail.
 236  func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 237  	if h, ok := a.t.(tHelper); ok {
 238  		h.Helper()
 239  	}
 240  	return Equalf(a.t, expected, actual, msg, args...)
 241  }
 242  
 243  // Error asserts that a function returned an error (i.e. not `nil`).
 244  //
 245  //	actualObj, err := SomeFunction()
 246  //	a.Error(err)
 247  func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {
 248  	if h, ok := a.t.(tHelper); ok {
 249  		h.Helper()
 250  	}
 251  	return Error(a.t, err, msgAndArgs...)
 252  }
 253  
 254  // ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
 255  // This is a wrapper for errors.As.
 256  func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool {
 257  	if h, ok := a.t.(tHelper); ok {
 258  		h.Helper()
 259  	}
 260  	return ErrorAs(a.t, err, target, msgAndArgs...)
 261  }
 262  
 263  // ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
 264  // This is a wrapper for errors.As.
 265  func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool {
 266  	if h, ok := a.t.(tHelper); ok {
 267  		h.Helper()
 268  	}
 269  	return ErrorAsf(a.t, err, target, msg, args...)
 270  }
 271  
 272  // ErrorContains asserts that a function returned an error (i.e. not `nil`)
 273  // and that the error contains the specified substring.
 274  //
 275  //	actualObj, err := SomeFunction()
 276  //	a.ErrorContains(err,  expectedErrorSubString)
 277  func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) bool {
 278  	if h, ok := a.t.(tHelper); ok {
 279  		h.Helper()
 280  	}
 281  	return ErrorContains(a.t, theError, contains, msgAndArgs...)
 282  }
 283  
 284  // ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
 285  // and that the error contains the specified substring.
 286  //
 287  //	actualObj, err := SomeFunction()
 288  //	a.ErrorContainsf(err,  expectedErrorSubString, "error message %s", "formatted")
 289  func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) bool {
 290  	if h, ok := a.t.(tHelper); ok {
 291  		h.Helper()
 292  	}
 293  	return ErrorContainsf(a.t, theError, contains, msg, args...)
 294  }
 295  
 296  // ErrorIs asserts that at least one of the errors in err's chain matches target.
 297  // This is a wrapper for errors.Is.
 298  func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) bool {
 299  	if h, ok := a.t.(tHelper); ok {
 300  		h.Helper()
 301  	}
 302  	return ErrorIs(a.t, err, target, msgAndArgs...)
 303  }
 304  
 305  // ErrorIsf asserts that at least one of the errors in err's chain matches target.
 306  // This is a wrapper for errors.Is.
 307  func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) bool {
 308  	if h, ok := a.t.(tHelper); ok {
 309  		h.Helper()
 310  	}
 311  	return ErrorIsf(a.t, err, target, msg, args...)
 312  }
 313  
 314  // Errorf asserts that a function returned an error (i.e. not `nil`).
 315  //
 316  //	actualObj, err := SomeFunction()
 317  //	a.Errorf(err, "error message %s", "formatted")
 318  func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool {
 319  	if h, ok := a.t.(tHelper); ok {
 320  		h.Helper()
 321  	}
 322  	return Errorf(a.t, err, msg, args...)
 323  }
 324  
 325  // Eventually asserts that given condition will be met in waitFor time,
 326  // periodically checking target function each tick.
 327  //
 328  //	a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond)
 329  func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
 330  	if h, ok := a.t.(tHelper); ok {
 331  		h.Helper()
 332  	}
 333  	return Eventually(a.t, condition, waitFor, tick, msgAndArgs...)
 334  }
 335  
 336  // EventuallyWithT asserts that given condition will be met in waitFor time,
 337  // periodically checking target function each tick. In contrast to Eventually,
 338  // it supplies a CollectT to the condition function, so that the condition
 339  // function can use the CollectT to call other assertions.
 340  // The condition is considered "met" if no errors are raised in a tick.
 341  // The supplied CollectT collects all errors from one tick (if there are any).
 342  // If the condition is not met before waitFor, the collected errors of
 343  // the last tick are copied to t.
 344  //
 345  //	externalValue := false
 346  //	go func() {
 347  //		time.Sleep(8*time.Second)
 348  //		externalValue = true
 349  //	}()
 350  //	a.EventuallyWithT(func(c *assert.CollectT) {
 351  //		// add assertions as needed; any assertion failure will fail the current tick
 352  //		assert.True(c, externalValue, "expected 'externalValue' to be true")
 353  //	}, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
 354  func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
 355  	if h, ok := a.t.(tHelper); ok {
 356  		h.Helper()
 357  	}
 358  	return EventuallyWithT(a.t, condition, waitFor, tick, msgAndArgs...)
 359  }
 360  
 361  // EventuallyWithTf asserts that given condition will be met in waitFor time,
 362  // periodically checking target function each tick. In contrast to Eventually,
 363  // it supplies a CollectT to the condition function, so that the condition
 364  // function can use the CollectT to call other assertions.
 365  // The condition is considered "met" if no errors are raised in a tick.
 366  // The supplied CollectT collects all errors from one tick (if there are any).
 367  // If the condition is not met before waitFor, the collected errors of
 368  // the last tick are copied to t.
 369  //
 370  //	externalValue := false
 371  //	go func() {
 372  //		time.Sleep(8*time.Second)
 373  //		externalValue = true
 374  //	}()
 375  //	a.EventuallyWithTf(func(c *assert.CollectT, "error message %s", "formatted") {
 376  //		// add assertions as needed; any assertion failure will fail the current tick
 377  //		assert.True(c, externalValue, "expected 'externalValue' to be true")
 378  //	}, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
 379  func (a *Assertions) EventuallyWithTf(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
 380  	if h, ok := a.t.(tHelper); ok {
 381  		h.Helper()
 382  	}
 383  	return EventuallyWithTf(a.t, condition, waitFor, tick, msg, args...)
 384  }
 385  
 386  // Eventuallyf asserts that given condition will be met in waitFor time,
 387  // periodically checking target function each tick.
 388  //
 389  //	a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
 390  func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
 391  	if h, ok := a.t.(tHelper); ok {
 392  		h.Helper()
 393  	}
 394  	return Eventuallyf(a.t, condition, waitFor, tick, msg, args...)
 395  }
 396  
 397  // Exactly asserts that two objects are equal in value and type.
 398  //
 399  //	a.Exactly(int32(123), int64(123))
 400  func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
 401  	if h, ok := a.t.(tHelper); ok {
 402  		h.Helper()
 403  	}
 404  	return Exactly(a.t, expected, actual, msgAndArgs...)
 405  }
 406  
 407  // Exactlyf asserts that two objects are equal in value and type.
 408  //
 409  //	a.Exactlyf(int32(123), int64(123), "error message %s", "formatted")
 410  func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
 411  	if h, ok := a.t.(tHelper); ok {
 412  		h.Helper()
 413  	}
 414  	return Exactlyf(a.t, expected, actual, msg, args...)
 415  }
 416  
 417  // Fail reports a failure through
 418  func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool {
 419  	if h, ok := a.t.(tHelper); ok {
 420  		h.Helper()
 421  	}
 422  	return Fail(a.t, failureMessage, msgAndArgs...)
 423  }
 424  
 425  // FailNow fails test
 426  func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool {
 427  	if h, ok := a.t.(tHelper); ok {
 428  		h.Helper()
 429  	}
 430  	return FailNow(a.t, failureMessage, msgAndArgs...)
 431  }
 432  
 433  // FailNowf fails test
 434  func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool {
 435  	if h, ok := a.t.(tHelper); ok {
 436  		h.Helper()
 437  	}
 438  	return FailNowf(a.t, failureMessage, msg, args...)
 439  }
 440  
 441  // Failf reports a failure through
 442  func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool {
 443  	if h, ok := a.t.(tHelper); ok {
 444  		h.Helper()
 445  	}
 446  	return Failf(a.t, failureMessage, msg, args...)
 447  }
 448  
 449  // False asserts that the specified value is false.
 450  //
 451  //	a.False(myBool)
 452  func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {
 453  	if h, ok := a.t.(tHelper); ok {
 454  		h.Helper()
 455  	}
 456  	return False(a.t, value, msgAndArgs...)
 457  }
 458  
 459  // Falsef asserts that the specified value is false.
 460  //
 461  //	a.Falsef(myBool, "error message %s", "formatted")
 462  func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool {
 463  	if h, ok := a.t.(tHelper); ok {
 464  		h.Helper()
 465  	}
 466  	return Falsef(a.t, value, msg, args...)
 467  }
 468  
 469  // FileExists checks whether a file exists in the given path. It also fails if
 470  // the path points to a directory or there is an error when trying to check the file.
 471  func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool {
 472  	if h, ok := a.t.(tHelper); ok {
 473  		h.Helper()
 474  	}
 475  	return FileExists(a.t, path, msgAndArgs...)
 476  }
 477  
 478  // FileExistsf checks whether a file exists in the given path. It also fails if
 479  // the path points to a directory or there is an error when trying to check the file.
 480  func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool {
 481  	if h, ok := a.t.(tHelper); ok {
 482  		h.Helper()
 483  	}
 484  	return FileExistsf(a.t, path, msg, args...)
 485  }
 486  
 487  // Greater asserts that the first element is greater than the second
 488  //
 489  //	a.Greater(2, 1)
 490  //	a.Greater(float64(2), float64(1))
 491  //	a.Greater("b", "a")
 492  func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
 493  	if h, ok := a.t.(tHelper); ok {
 494  		h.Helper()
 495  	}
 496  	return Greater(a.t, e1, e2, msgAndArgs...)
 497  }
 498  
 499  // GreaterOrEqual asserts that the first element is greater than or equal to the second
 500  //
 501  //	a.GreaterOrEqual(2, 1)
 502  //	a.GreaterOrEqual(2, 2)
 503  //	a.GreaterOrEqual("b", "a")
 504  //	a.GreaterOrEqual("b", "b")
 505  func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
 506  	if h, ok := a.t.(tHelper); ok {
 507  		h.Helper()
 508  	}
 509  	return GreaterOrEqual(a.t, e1, e2, msgAndArgs...)
 510  }
 511  
 512  // GreaterOrEqualf asserts that the first element is greater than or equal to the second
 513  //
 514  //	a.GreaterOrEqualf(2, 1, "error message %s", "formatted")
 515  //	a.GreaterOrEqualf(2, 2, "error message %s", "formatted")
 516  //	a.GreaterOrEqualf("b", "a", "error message %s", "formatted")
 517  //	a.GreaterOrEqualf("b", "b", "error message %s", "formatted")
 518  func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
 519  	if h, ok := a.t.(tHelper); ok {
 520  		h.Helper()
 521  	}
 522  	return GreaterOrEqualf(a.t, e1, e2, msg, args...)
 523  }
 524  
 525  // Greaterf asserts that the first element is greater than the second
 526  //
 527  //	a.Greaterf(2, 1, "error message %s", "formatted")
 528  //	a.Greaterf(float64(2), float64(1), "error message %s", "formatted")
 529  //	a.Greaterf("b", "a", "error message %s", "formatted")
 530  func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
 531  	if h, ok := a.t.(tHelper); ok {
 532  		h.Helper()
 533  	}
 534  	return Greaterf(a.t, e1, e2, msg, args...)
 535  }
 536  
 537  // HTTPBodyContains asserts that a specified handler returns a
 538  // body that contains a string.
 539  //
 540  //	a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
 541  //
 542  // Returns whether the assertion was successful (true) or not (false).
 543  func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
 544  	if h, ok := a.t.(tHelper); ok {
 545  		h.Helper()
 546  	}
 547  	return HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)
 548  }
 549  
 550  // HTTPBodyContainsf asserts that a specified handler returns a
 551  // body that contains a string.
 552  //
 553  //	a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
 554  //
 555  // Returns whether the assertion was successful (true) or not (false).
 556  func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
 557  	if h, ok := a.t.(tHelper); ok {
 558  		h.Helper()
 559  	}
 560  	return HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)
 561  }
 562  
 563  // HTTPBodyNotContains asserts that a specified handler returns a
 564  // body that does not contain a string.
 565  //
 566  //	a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
 567  //
 568  // Returns whether the assertion was successful (true) or not (false).
 569  func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
 570  	if h, ok := a.t.(tHelper); ok {
 571  		h.Helper()
 572  	}
 573  	return HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)
 574  }
 575  
 576  // HTTPBodyNotContainsf asserts that a specified handler returns a
 577  // body that does not contain a string.
 578  //
 579  //	a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
 580  //
 581  // Returns whether the assertion was successful (true) or not (false).
 582  func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
 583  	if h, ok := a.t.(tHelper); ok {
 584  		h.Helper()
 585  	}
 586  	return HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)
 587  }
 588  
 589  // HTTPError asserts that a specified handler returns an error status code.
 590  //
 591  //	a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
 592  //
 593  // Returns whether the assertion was successful (true) or not (false).
 594  func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
 595  	if h, ok := a.t.(tHelper); ok {
 596  		h.Helper()
 597  	}
 598  	return HTTPError(a.t, handler, method, url, values, msgAndArgs...)
 599  }
 600  
 601  // HTTPErrorf asserts that a specified handler returns an error status code.
 602  //
 603  //	a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
 604  //
 605  // Returns whether the assertion was successful (true) or not (false).
 606  func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
 607  	if h, ok := a.t.(tHelper); ok {
 608  		h.Helper()
 609  	}
 610  	return HTTPErrorf(a.t, handler, method, url, values, msg, args...)
 611  }
 612  
 613  // HTTPRedirect asserts that a specified handler returns a redirect status code.
 614  //
 615  //	a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
 616  //
 617  // Returns whether the assertion was successful (true) or not (false).
 618  func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
 619  	if h, ok := a.t.(tHelper); ok {
 620  		h.Helper()
 621  	}
 622  	return HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)
 623  }
 624  
 625  // HTTPRedirectf asserts that a specified handler returns a redirect status code.
 626  //
 627  //	a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
 628  //
 629  // Returns whether the assertion was successful (true) or not (false).
 630  func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
 631  	if h, ok := a.t.(tHelper); ok {
 632  		h.Helper()
 633  	}
 634  	return HTTPRedirectf(a.t, handler, method, url, values, msg, args...)
 635  }
 636  
 637  // HTTPStatusCode asserts that a specified handler returns a specified status code.
 638  //
 639  //	a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501)
 640  //
 641  // Returns whether the assertion was successful (true) or not (false).
 642  func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool {
 643  	if h, ok := a.t.(tHelper); ok {
 644  		h.Helper()
 645  	}
 646  	return HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...)
 647  }
 648  
 649  // HTTPStatusCodef asserts that a specified handler returns a specified status code.
 650  //
 651  //	a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
 652  //
 653  // Returns whether the assertion was successful (true) or not (false).
 654  func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool {
 655  	if h, ok := a.t.(tHelper); ok {
 656  		h.Helper()
 657  	}
 658  	return HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...)
 659  }
 660  
 661  // HTTPSuccess asserts that a specified handler returns a success status code.
 662  //
 663  //	a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
 664  //
 665  // Returns whether the assertion was successful (true) or not (false).
 666  func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
 667  	if h, ok := a.t.(tHelper); ok {
 668  		h.Helper()
 669  	}
 670  	return HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)
 671  }
 672  
 673  // HTTPSuccessf asserts that a specified handler returns a success status code.
 674  //
 675  //	a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
 676  //
 677  // Returns whether the assertion was successful (true) or not (false).
 678  func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
 679  	if h, ok := a.t.(tHelper); ok {
 680  		h.Helper()
 681  	}
 682  	return HTTPSuccessf(a.t, handler, method, url, values, msg, args...)
 683  }
 684  
 685  // Implements asserts that an object is implemented by the specified interface.
 686  //
 687  //	a.Implements((*MyInterface)(nil), new(MyObject))
 688  func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
 689  	if h, ok := a.t.(tHelper); ok {
 690  		h.Helper()
 691  	}
 692  	return Implements(a.t, interfaceObject, object, msgAndArgs...)
 693  }
 694  
 695  // Implementsf asserts that an object is implemented by the specified interface.
 696  //
 697  //	a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
 698  func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
 699  	if h, ok := a.t.(tHelper); ok {
 700  		h.Helper()
 701  	}
 702  	return Implementsf(a.t, interfaceObject, object, msg, args...)
 703  }
 704  
 705  // InDelta asserts that the two numerals are within delta of each other.
 706  //
 707  //	a.InDelta(math.Pi, 22/7.0, 0.01)
 708  func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
 709  	if h, ok := a.t.(tHelper); ok {
 710  		h.Helper()
 711  	}
 712  	return InDelta(a.t, expected, actual, delta, msgAndArgs...)
 713  }
 714  
 715  // InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
 716  func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
 717  	if h, ok := a.t.(tHelper); ok {
 718  		h.Helper()
 719  	}
 720  	return InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)
 721  }
 722  
 723  // InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
 724  func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
 725  	if h, ok := a.t.(tHelper); ok {
 726  		h.Helper()
 727  	}
 728  	return InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)
 729  }
 730  
 731  // InDeltaSlice is the same as InDelta, except it compares two slices.
 732  func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
 733  	if h, ok := a.t.(tHelper); ok {
 734  		h.Helper()
 735  	}
 736  	return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
 737  }
 738  
 739  // InDeltaSlicef is the same as InDelta, except it compares two slices.
 740  func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
 741  	if h, ok := a.t.(tHelper); ok {
 742  		h.Helper()
 743  	}
 744  	return InDeltaSlicef(a.t, expected, actual, delta, msg, args...)
 745  }
 746  
 747  // InDeltaf asserts that the two numerals are within delta of each other.
 748  //
 749  //	a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
 750  func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
 751  	if h, ok := a.t.(tHelper); ok {
 752  		h.Helper()
 753  	}
 754  	return InDeltaf(a.t, expected, actual, delta, msg, args...)
 755  }
 756  
 757  // InEpsilon asserts that expected and actual have a relative error less than epsilon
 758  func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
 759  	if h, ok := a.t.(tHelper); ok {
 760  		h.Helper()
 761  	}
 762  	return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
 763  }
 764  
 765  // InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
 766  func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
 767  	if h, ok := a.t.(tHelper); ok {
 768  		h.Helper()
 769  	}
 770  	return InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)
 771  }
 772  
 773  // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
 774  func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
 775  	if h, ok := a.t.(tHelper); ok {
 776  		h.Helper()
 777  	}
 778  	return InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)
 779  }
 780  
 781  // InEpsilonf asserts that expected and actual have a relative error less than epsilon
 782  func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
 783  	if h, ok := a.t.(tHelper); ok {
 784  		h.Helper()
 785  	}
 786  	return InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
 787  }
 788  
 789  // IsDecreasing asserts that the collection is decreasing
 790  //
 791  //	a.IsDecreasing([]int{2, 1, 0})
 792  //	a.IsDecreasing([]float{2, 1})
 793  //	a.IsDecreasing([]string{"b", "a"})
 794  func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool {
 795  	if h, ok := a.t.(tHelper); ok {
 796  		h.Helper()
 797  	}
 798  	return IsDecreasing(a.t, object, msgAndArgs...)
 799  }
 800  
 801  // IsDecreasingf asserts that the collection is decreasing
 802  //
 803  //	a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted")
 804  //	a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted")
 805  //	a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted")
 806  func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) bool {
 807  	if h, ok := a.t.(tHelper); ok {
 808  		h.Helper()
 809  	}
 810  	return IsDecreasingf(a.t, object, msg, args...)
 811  }
 812  
 813  // IsIncreasing asserts that the collection is increasing
 814  //
 815  //	a.IsIncreasing([]int{1, 2, 3})
 816  //	a.IsIncreasing([]float{1, 2})
 817  //	a.IsIncreasing([]string{"a", "b"})
 818  func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool {
 819  	if h, ok := a.t.(tHelper); ok {
 820  		h.Helper()
 821  	}
 822  	return IsIncreasing(a.t, object, msgAndArgs...)
 823  }
 824  
 825  // IsIncreasingf asserts that the collection is increasing
 826  //
 827  //	a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted")
 828  //	a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted")
 829  //	a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted")
 830  func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) bool {
 831  	if h, ok := a.t.(tHelper); ok {
 832  		h.Helper()
 833  	}
 834  	return IsIncreasingf(a.t, object, msg, args...)
 835  }
 836  
 837  // IsNonDecreasing asserts that the collection is not decreasing
 838  //
 839  //	a.IsNonDecreasing([]int{1, 1, 2})
 840  //	a.IsNonDecreasing([]float{1, 2})
 841  //	a.IsNonDecreasing([]string{"a", "b"})
 842  func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool {
 843  	if h, ok := a.t.(tHelper); ok {
 844  		h.Helper()
 845  	}
 846  	return IsNonDecreasing(a.t, object, msgAndArgs...)
 847  }
 848  
 849  // IsNonDecreasingf asserts that the collection is not decreasing
 850  //
 851  //	a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted")
 852  //	a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted")
 853  //	a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted")
 854  func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) bool {
 855  	if h, ok := a.t.(tHelper); ok {
 856  		h.Helper()
 857  	}
 858  	return IsNonDecreasingf(a.t, object, msg, args...)
 859  }
 860  
 861  // IsNonIncreasing asserts that the collection is not increasing
 862  //
 863  //	a.IsNonIncreasing([]int{2, 1, 1})
 864  //	a.IsNonIncreasing([]float{2, 1})
 865  //	a.IsNonIncreasing([]string{"b", "a"})
 866  func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool {
 867  	if h, ok := a.t.(tHelper); ok {
 868  		h.Helper()
 869  	}
 870  	return IsNonIncreasing(a.t, object, msgAndArgs...)
 871  }
 872  
 873  // IsNonIncreasingf asserts that the collection is not increasing
 874  //
 875  //	a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted")
 876  //	a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted")
 877  //	a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted")
 878  func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) bool {
 879  	if h, ok := a.t.(tHelper); ok {
 880  		h.Helper()
 881  	}
 882  	return IsNonIncreasingf(a.t, object, msg, args...)
 883  }
 884  
 885  // IsNotType asserts that the specified objects are not of the same type.
 886  //
 887  //	a.IsNotType(&NotMyStruct{}, &MyStruct{})
 888  func (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) bool {
 889  	if h, ok := a.t.(tHelper); ok {
 890  		h.Helper()
 891  	}
 892  	return IsNotType(a.t, theType, object, msgAndArgs...)
 893  }
 894  
 895  // IsNotTypef asserts that the specified objects are not of the same type.
 896  //
 897  //	a.IsNotTypef(&NotMyStruct{}, &MyStruct{}, "error message %s", "formatted")
 898  func (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) bool {
 899  	if h, ok := a.t.(tHelper); ok {
 900  		h.Helper()
 901  	}
 902  	return IsNotTypef(a.t, theType, object, msg, args...)
 903  }
 904  
 905  // IsType asserts that the specified objects are of the same type.
 906  //
 907  //	a.IsType(&MyStruct{}, &MyStruct{})
 908  func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {
 909  	if h, ok := a.t.(tHelper); ok {
 910  		h.Helper()
 911  	}
 912  	return IsType(a.t, expectedType, object, msgAndArgs...)
 913  }
 914  
 915  // IsTypef asserts that the specified objects are of the same type.
 916  //
 917  //	a.IsTypef(&MyStruct{}, &MyStruct{}, "error message %s", "formatted")
 918  func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
 919  	if h, ok := a.t.(tHelper); ok {
 920  		h.Helper()
 921  	}
 922  	return IsTypef(a.t, expectedType, object, msg, args...)
 923  }
 924  
 925  // JSONEq asserts that two JSON strings are equivalent.
 926  //
 927  //	a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
 928  func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool {
 929  	if h, ok := a.t.(tHelper); ok {
 930  		h.Helper()
 931  	}
 932  	return JSONEq(a.t, expected, actual, msgAndArgs...)
 933  }
 934  
 935  // JSONEqf asserts that two JSON strings are equivalent.
 936  //
 937  //	a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
 938  func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool {
 939  	if h, ok := a.t.(tHelper); ok {
 940  		h.Helper()
 941  	}
 942  	return JSONEqf(a.t, expected, actual, msg, args...)
 943  }
 944  
 945  // Len asserts that the specified object has specific length.
 946  // Len also fails if the object has a type that len() not accept.
 947  //
 948  //	a.Len(mySlice, 3)
 949  func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool {
 950  	if h, ok := a.t.(tHelper); ok {
 951  		h.Helper()
 952  	}
 953  	return Len(a.t, object, length, msgAndArgs...)
 954  }
 955  
 956  // Lenf asserts that the specified object has specific length.
 957  // Lenf also fails if the object has a type that len() not accept.
 958  //
 959  //	a.Lenf(mySlice, 3, "error message %s", "formatted")
 960  func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool {
 961  	if h, ok := a.t.(tHelper); ok {
 962  		h.Helper()
 963  	}
 964  	return Lenf(a.t, object, length, msg, args...)
 965  }
 966  
 967  // Less asserts that the first element is less than the second
 968  //
 969  //	a.Less(1, 2)
 970  //	a.Less(float64(1), float64(2))
 971  //	a.Less("a", "b")
 972  func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
 973  	if h, ok := a.t.(tHelper); ok {
 974  		h.Helper()
 975  	}
 976  	return Less(a.t, e1, e2, msgAndArgs...)
 977  }
 978  
 979  // LessOrEqual asserts that the first element is less than or equal to the second
 980  //
 981  //	a.LessOrEqual(1, 2)
 982  //	a.LessOrEqual(2, 2)
 983  //	a.LessOrEqual("a", "b")
 984  //	a.LessOrEqual("b", "b")
 985  func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
 986  	if h, ok := a.t.(tHelper); ok {
 987  		h.Helper()
 988  	}
 989  	return LessOrEqual(a.t, e1, e2, msgAndArgs...)
 990  }
 991  
 992  // LessOrEqualf asserts that the first element is less than or equal to the second
 993  //
 994  //	a.LessOrEqualf(1, 2, "error message %s", "formatted")
 995  //	a.LessOrEqualf(2, 2, "error message %s", "formatted")
 996  //	a.LessOrEqualf("a", "b", "error message %s", "formatted")
 997  //	a.LessOrEqualf("b", "b", "error message %s", "formatted")
 998  func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
 999  	if h, ok := a.t.(tHelper); ok {
1000  		h.Helper()
1001  	}
1002  	return LessOrEqualf(a.t, e1, e2, msg, args...)
1003  }
1004  
1005  // Lessf asserts that the first element is less than the second
1006  //
1007  //	a.Lessf(1, 2, "error message %s", "formatted")
1008  //	a.Lessf(float64(1), float64(2), "error message %s", "formatted")
1009  //	a.Lessf("a", "b", "error message %s", "formatted")
1010  func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
1011  	if h, ok := a.t.(tHelper); ok {
1012  		h.Helper()
1013  	}
1014  	return Lessf(a.t, e1, e2, msg, args...)
1015  }
1016  
1017  // Negative asserts that the specified element is negative
1018  //
1019  //	a.Negative(-1)
1020  //	a.Negative(-1.23)
1021  func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) bool {
1022  	if h, ok := a.t.(tHelper); ok {
1023  		h.Helper()
1024  	}
1025  	return Negative(a.t, e, msgAndArgs...)
1026  }
1027  
1028  // Negativef asserts that the specified element is negative
1029  //
1030  //	a.Negativef(-1, "error message %s", "formatted")
1031  //	a.Negativef(-1.23, "error message %s", "formatted")
1032  func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) bool {
1033  	if h, ok := a.t.(tHelper); ok {
1034  		h.Helper()
1035  	}
1036  	return Negativef(a.t, e, msg, args...)
1037  }
1038  
1039  // Never asserts that the given condition doesn't satisfy in waitFor time,
1040  // periodically checking the target function each tick.
1041  //
1042  //	a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond)
1043  func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
1044  	if h, ok := a.t.(tHelper); ok {
1045  		h.Helper()
1046  	}
1047  	return Never(a.t, condition, waitFor, tick, msgAndArgs...)
1048  }
1049  
1050  // Neverf asserts that the given condition doesn't satisfy in waitFor time,
1051  // periodically checking the target function each tick.
1052  //
1053  //	a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
1054  func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
1055  	if h, ok := a.t.(tHelper); ok {
1056  		h.Helper()
1057  	}
1058  	return Neverf(a.t, condition, waitFor, tick, msg, args...)
1059  }
1060  
1061  // Nil asserts that the specified object is nil.
1062  //
1063  //	a.Nil(err)
1064  func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {
1065  	if h, ok := a.t.(tHelper); ok {
1066  		h.Helper()
1067  	}
1068  	return Nil(a.t, object, msgAndArgs...)
1069  }
1070  
1071  // Nilf asserts that the specified object is nil.
1072  //
1073  //	a.Nilf(err, "error message %s", "formatted")
1074  func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool {
1075  	if h, ok := a.t.(tHelper); ok {
1076  		h.Helper()
1077  	}
1078  	return Nilf(a.t, object, msg, args...)
1079  }
1080  
1081  // NoDirExists checks whether a directory does not exist in the given path.
1082  // It fails if the path points to an existing _directory_ only.
1083  func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) bool {
1084  	if h, ok := a.t.(tHelper); ok {
1085  		h.Helper()
1086  	}
1087  	return NoDirExists(a.t, path, msgAndArgs...)
1088  }
1089  
1090  // NoDirExistsf checks whether a directory does not exist in the given path.
1091  // It fails if the path points to an existing _directory_ only.
1092  func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) bool {
1093  	if h, ok := a.t.(tHelper); ok {
1094  		h.Helper()
1095  	}
1096  	return NoDirExistsf(a.t, path, msg, args...)
1097  }
1098  
1099  // NoError asserts that a function returned no error (i.e. `nil`).
1100  //
1101  //	  actualObj, err := SomeFunction()
1102  //	  if a.NoError(err) {
1103  //		   assert.Equal(t, expectedObj, actualObj)
1104  //	  }
1105  func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {
1106  	if h, ok := a.t.(tHelper); ok {
1107  		h.Helper()
1108  	}
1109  	return NoError(a.t, err, msgAndArgs...)
1110  }
1111  
1112  // NoErrorf asserts that a function returned no error (i.e. `nil`).
1113  //
1114  //	  actualObj, err := SomeFunction()
1115  //	  if a.NoErrorf(err, "error message %s", "formatted") {
1116  //		   assert.Equal(t, expectedObj, actualObj)
1117  //	  }
1118  func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {
1119  	if h, ok := a.t.(tHelper); ok {
1120  		h.Helper()
1121  	}
1122  	return NoErrorf(a.t, err, msg, args...)
1123  }
1124  
1125  // NoFileExists checks whether a file does not exist in a given path. It fails
1126  // if the path points to an existing _file_ only.
1127  func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) bool {
1128  	if h, ok := a.t.(tHelper); ok {
1129  		h.Helper()
1130  	}
1131  	return NoFileExists(a.t, path, msgAndArgs...)
1132  }
1133  
1134  // NoFileExistsf checks whether a file does not exist in a given path. It fails
1135  // if the path points to an existing _file_ only.
1136  func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) bool {
1137  	if h, ok := a.t.(tHelper); ok {
1138  		h.Helper()
1139  	}
1140  	return NoFileExistsf(a.t, path, msg, args...)
1141  }
1142  
1143  // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
1144  // specified substring or element.
1145  //
1146  //	a.NotContains("Hello World", "Earth")
1147  //	a.NotContains(["Hello", "World"], "Earth")
1148  //	a.NotContains({"Hello": "World"}, "Earth")
1149  func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
1150  	if h, ok := a.t.(tHelper); ok {
1151  		h.Helper()
1152  	}
1153  	return NotContains(a.t, s, contains, msgAndArgs...)
1154  }
1155  
1156  // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
1157  // specified substring or element.
1158  //
1159  //	a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
1160  //	a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
1161  //	a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
1162  func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
1163  	if h, ok := a.t.(tHelper); ok {
1164  		h.Helper()
1165  	}
1166  	return NotContainsf(a.t, s, contains, msg, args...)
1167  }
1168  
1169  // NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified
1170  // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
1171  // the number of appearances of each of them in both lists should not match.
1172  // This is an inverse of ElementsMatch.
1173  //
1174  // a.NotElementsMatch([1, 1, 2, 3], [1, 1, 2, 3]) -> false
1175  //
1176  // a.NotElementsMatch([1, 1, 2, 3], [1, 2, 3]) -> true
1177  //
1178  // a.NotElementsMatch([1, 2, 3], [1, 2, 4]) -> true
1179  func (a *Assertions) NotElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool {
1180  	if h, ok := a.t.(tHelper); ok {
1181  		h.Helper()
1182  	}
1183  	return NotElementsMatch(a.t, listA, listB, msgAndArgs...)
1184  }
1185  
1186  // NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified
1187  // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
1188  // the number of appearances of each of them in both lists should not match.
1189  // This is an inverse of ElementsMatch.
1190  //
1191  // a.NotElementsMatchf([1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false
1192  //
1193  // a.NotElementsMatchf([1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true
1194  //
1195  // a.NotElementsMatchf([1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true
1196  func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
1197  	if h, ok := a.t.(tHelper); ok {
1198  		h.Helper()
1199  	}
1200  	return NotElementsMatchf(a.t, listA, listB, msg, args...)
1201  }
1202  
1203  // NotEmpty asserts that the specified object is NOT [Empty].
1204  //
1205  //	if a.NotEmpty(obj) {
1206  //	  assert.Equal(t, "two", obj[1])
1207  //	}
1208  func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool {
1209  	if h, ok := a.t.(tHelper); ok {
1210  		h.Helper()
1211  	}
1212  	return NotEmpty(a.t, object, msgAndArgs...)
1213  }
1214  
1215  // NotEmptyf asserts that the specified object is NOT [Empty].
1216  //
1217  //	if a.NotEmptyf(obj, "error message %s", "formatted") {
1218  //	  assert.Equal(t, "two", obj[1])
1219  //	}
1220  func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool {
1221  	if h, ok := a.t.(tHelper); ok {
1222  		h.Helper()
1223  	}
1224  	return NotEmptyf(a.t, object, msg, args...)
1225  }
1226  
1227  // NotEqual asserts that the specified values are NOT equal.
1228  //
1229  //	a.NotEqual(obj1, obj2)
1230  //
1231  // Pointer variable equality is determined based on the equality of the
1232  // referenced values (as opposed to the memory addresses).
1233  func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
1234  	if h, ok := a.t.(tHelper); ok {
1235  		h.Helper()
1236  	}
1237  	return NotEqual(a.t, expected, actual, msgAndArgs...)
1238  }
1239  
1240  // NotEqualValues asserts that two objects are not equal even when converted to the same type
1241  //
1242  //	a.NotEqualValues(obj1, obj2)
1243  func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
1244  	if h, ok := a.t.(tHelper); ok {
1245  		h.Helper()
1246  	}
1247  	return NotEqualValues(a.t, expected, actual, msgAndArgs...)
1248  }
1249  
1250  // NotEqualValuesf asserts that two objects are not equal even when converted to the same type
1251  //
1252  //	a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted")
1253  func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
1254  	if h, ok := a.t.(tHelper); ok {
1255  		h.Helper()
1256  	}
1257  	return NotEqualValuesf(a.t, expected, actual, msg, args...)
1258  }
1259  
1260  // NotEqualf asserts that the specified values are NOT equal.
1261  //
1262  //	a.NotEqualf(obj1, obj2, "error message %s", "formatted")
1263  //
1264  // Pointer variable equality is determined based on the equality of the
1265  // referenced values (as opposed to the memory addresses).
1266  func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
1267  	if h, ok := a.t.(tHelper); ok {
1268  		h.Helper()
1269  	}
1270  	return NotEqualf(a.t, expected, actual, msg, args...)
1271  }
1272  
1273  // NotErrorAs asserts that none of the errors in err's chain matches target,
1274  // but if so, sets target to that error value.
1275  func (a *Assertions) NotErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool {
1276  	if h, ok := a.t.(tHelper); ok {
1277  		h.Helper()
1278  	}
1279  	return NotErrorAs(a.t, err, target, msgAndArgs...)
1280  }
1281  
1282  // NotErrorAsf asserts that none of the errors in err's chain matches target,
1283  // but if so, sets target to that error value.
1284  func (a *Assertions) NotErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool {
1285  	if h, ok := a.t.(tHelper); ok {
1286  		h.Helper()
1287  	}
1288  	return NotErrorAsf(a.t, err, target, msg, args...)
1289  }
1290  
1291  // NotErrorIs asserts that none of the errors in err's chain matches target.
1292  // This is a wrapper for errors.Is.
1293  func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) bool {
1294  	if h, ok := a.t.(tHelper); ok {
1295  		h.Helper()
1296  	}
1297  	return NotErrorIs(a.t, err, target, msgAndArgs...)
1298  }
1299  
1300  // NotErrorIsf asserts that none of the errors in err's chain matches target.
1301  // This is a wrapper for errors.Is.
1302  func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) bool {
1303  	if h, ok := a.t.(tHelper); ok {
1304  		h.Helper()
1305  	}
1306  	return NotErrorIsf(a.t, err, target, msg, args...)
1307  }
1308  
1309  // NotImplements asserts that an object does not implement the specified interface.
1310  //
1311  //	a.NotImplements((*MyInterface)(nil), new(MyObject))
1312  func (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
1313  	if h, ok := a.t.(tHelper); ok {
1314  		h.Helper()
1315  	}
1316  	return NotImplements(a.t, interfaceObject, object, msgAndArgs...)
1317  }
1318  
1319  // NotImplementsf asserts that an object does not implement the specified interface.
1320  //
1321  //	a.NotImplementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
1322  func (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
1323  	if h, ok := a.t.(tHelper); ok {
1324  		h.Helper()
1325  	}
1326  	return NotImplementsf(a.t, interfaceObject, object, msg, args...)
1327  }
1328  
1329  // NotNil asserts that the specified object is not nil.
1330  //
1331  //	a.NotNil(err)
1332  func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool {
1333  	if h, ok := a.t.(tHelper); ok {
1334  		h.Helper()
1335  	}
1336  	return NotNil(a.t, object, msgAndArgs...)
1337  }
1338  
1339  // NotNilf asserts that the specified object is not nil.
1340  //
1341  //	a.NotNilf(err, "error message %s", "formatted")
1342  func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool {
1343  	if h, ok := a.t.(tHelper); ok {
1344  		h.Helper()
1345  	}
1346  	return NotNilf(a.t, object, msg, args...)
1347  }
1348  
1349  // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
1350  //
1351  //	a.NotPanics(func(){ RemainCalm() })
1352  func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
1353  	if h, ok := a.t.(tHelper); ok {
1354  		h.Helper()
1355  	}
1356  	return NotPanics(a.t, f, msgAndArgs...)
1357  }
1358  
1359  // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
1360  //
1361  //	a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
1362  func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
1363  	if h, ok := a.t.(tHelper); ok {
1364  		h.Helper()
1365  	}
1366  	return NotPanicsf(a.t, f, msg, args...)
1367  }
1368  
1369  // NotRegexp asserts that a specified regexp does not match a string.
1370  //
1371  //	a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
1372  //	a.NotRegexp("^start", "it's not starting")
1373  func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
1374  	if h, ok := a.t.(tHelper); ok {
1375  		h.Helper()
1376  	}
1377  	return NotRegexp(a.t, rx, str, msgAndArgs...)
1378  }
1379  
1380  // NotRegexpf asserts that a specified regexp does not match a string.
1381  //
1382  //	a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
1383  //	a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
1384  func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
1385  	if h, ok := a.t.(tHelper); ok {
1386  		h.Helper()
1387  	}
1388  	return NotRegexpf(a.t, rx, str, msg, args...)
1389  }
1390  
1391  // NotSame asserts that two pointers do not reference the same object.
1392  //
1393  //	a.NotSame(ptr1, ptr2)
1394  //
1395  // Both arguments must be pointer variables. Pointer variable sameness is
1396  // determined based on the equality of both type and value.
1397  func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
1398  	if h, ok := a.t.(tHelper); ok {
1399  		h.Helper()
1400  	}
1401  	return NotSame(a.t, expected, actual, msgAndArgs...)
1402  }
1403  
1404  // NotSamef asserts that two pointers do not reference the same object.
1405  //
1406  //	a.NotSamef(ptr1, ptr2, "error message %s", "formatted")
1407  //
1408  // Both arguments must be pointer variables. Pointer variable sameness is
1409  // determined based on the equality of both type and value.
1410  func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
1411  	if h, ok := a.t.(tHelper); ok {
1412  		h.Helper()
1413  	}
1414  	return NotSamef(a.t, expected, actual, msg, args...)
1415  }
1416  
1417  // NotSubset asserts that the list (array, slice, or map) does NOT contain all
1418  // elements given in the subset (array, slice, or map).
1419  // Map elements are key-value pairs unless compared with an array or slice where
1420  // only the map key is evaluated.
1421  //
1422  //	a.NotSubset([1, 3, 4], [1, 2])
1423  //	a.NotSubset({"x": 1, "y": 2}, {"z": 3})
1424  //	a.NotSubset([1, 3, 4], {1: "one", 2: "two"})
1425  //	a.NotSubset({"x": 1, "y": 2}, ["z"])
1426  func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
1427  	if h, ok := a.t.(tHelper); ok {
1428  		h.Helper()
1429  	}
1430  	return NotSubset(a.t, list, subset, msgAndArgs...)
1431  }
1432  
1433  // NotSubsetf asserts that the list (array, slice, or map) does NOT contain all
1434  // elements given in the subset (array, slice, or map).
1435  // Map elements are key-value pairs unless compared with an array or slice where
1436  // only the map key is evaluated.
1437  //
1438  //	a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted")
1439  //	a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted")
1440  //	a.NotSubsetf([1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted")
1441  //	a.NotSubsetf({"x": 1, "y": 2}, ["z"], "error message %s", "formatted")
1442  func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
1443  	if h, ok := a.t.(tHelper); ok {
1444  		h.Helper()
1445  	}
1446  	return NotSubsetf(a.t, list, subset, msg, args...)
1447  }
1448  
1449  // NotZero asserts that i is not the zero value for its type.
1450  func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool {
1451  	if h, ok := a.t.(tHelper); ok {
1452  		h.Helper()
1453  	}
1454  	return NotZero(a.t, i, msgAndArgs...)
1455  }
1456  
1457  // NotZerof asserts that i is not the zero value for its type.
1458  func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool {
1459  	if h, ok := a.t.(tHelper); ok {
1460  		h.Helper()
1461  	}
1462  	return NotZerof(a.t, i, msg, args...)
1463  }
1464  
1465  // Panics asserts that the code inside the specified PanicTestFunc panics.
1466  //
1467  //	a.Panics(func(){ GoCrazy() })
1468  func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
1469  	if h, ok := a.t.(tHelper); ok {
1470  		h.Helper()
1471  	}
1472  	return Panics(a.t, f, msgAndArgs...)
1473  }
1474  
1475  // PanicsWithError asserts that the code inside the specified PanicTestFunc
1476  // panics, and that the recovered panic value is an error that satisfies the
1477  // EqualError comparison.
1478  //
1479  //	a.PanicsWithError("crazy error", func(){ GoCrazy() })
1480  func (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool {
1481  	if h, ok := a.t.(tHelper); ok {
1482  		h.Helper()
1483  	}
1484  	return PanicsWithError(a.t, errString, f, msgAndArgs...)
1485  }
1486  
1487  // PanicsWithErrorf asserts that the code inside the specified PanicTestFunc
1488  // panics, and that the recovered panic value is an error that satisfies the
1489  // EqualError comparison.
1490  //
1491  //	a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
1492  func (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc, msg string, args ...interface{}) bool {
1493  	if h, ok := a.t.(tHelper); ok {
1494  		h.Helper()
1495  	}
1496  	return PanicsWithErrorf(a.t, errString, f, msg, args...)
1497  }
1498  
1499  // PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
1500  // the recovered panic value equals the expected panic value.
1501  //
1502  //	a.PanicsWithValue("crazy error", func(){ GoCrazy() })
1503  func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
1504  	if h, ok := a.t.(tHelper); ok {
1505  		h.Helper()
1506  	}
1507  	return PanicsWithValue(a.t, expected, f, msgAndArgs...)
1508  }
1509  
1510  // PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
1511  // the recovered panic value equals the expected panic value.
1512  //
1513  //	a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
1514  func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
1515  	if h, ok := a.t.(tHelper); ok {
1516  		h.Helper()
1517  	}
1518  	return PanicsWithValuef(a.t, expected, f, msg, args...)
1519  }
1520  
1521  // Panicsf asserts that the code inside the specified PanicTestFunc panics.
1522  //
1523  //	a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
1524  func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
1525  	if h, ok := a.t.(tHelper); ok {
1526  		h.Helper()
1527  	}
1528  	return Panicsf(a.t, f, msg, args...)
1529  }
1530  
1531  // Positive asserts that the specified element is positive
1532  //
1533  //	a.Positive(1)
1534  //	a.Positive(1.23)
1535  func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) bool {
1536  	if h, ok := a.t.(tHelper); ok {
1537  		h.Helper()
1538  	}
1539  	return Positive(a.t, e, msgAndArgs...)
1540  }
1541  
1542  // Positivef asserts that the specified element is positive
1543  //
1544  //	a.Positivef(1, "error message %s", "formatted")
1545  //	a.Positivef(1.23, "error message %s", "formatted")
1546  func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) bool {
1547  	if h, ok := a.t.(tHelper); ok {
1548  		h.Helper()
1549  	}
1550  	return Positivef(a.t, e, msg, args...)
1551  }
1552  
1553  // Regexp asserts that a specified regexp matches a string.
1554  //
1555  //	a.Regexp(regexp.MustCompile("start"), "it's starting")
1556  //	a.Regexp("start...$", "it's not starting")
1557  func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
1558  	if h, ok := a.t.(tHelper); ok {
1559  		h.Helper()
1560  	}
1561  	return Regexp(a.t, rx, str, msgAndArgs...)
1562  }
1563  
1564  // Regexpf asserts that a specified regexp matches a string.
1565  //
1566  //	a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
1567  //	a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
1568  func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
1569  	if h, ok := a.t.(tHelper); ok {
1570  		h.Helper()
1571  	}
1572  	return Regexpf(a.t, rx, str, msg, args...)
1573  }
1574  
1575  // Same asserts that two pointers reference the same object.
1576  //
1577  //	a.Same(ptr1, ptr2)
1578  //
1579  // Both arguments must be pointer variables. Pointer variable sameness is
1580  // determined based on the equality of both type and value.
1581  func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
1582  	if h, ok := a.t.(tHelper); ok {
1583  		h.Helper()
1584  	}
1585  	return Same(a.t, expected, actual, msgAndArgs...)
1586  }
1587  
1588  // Samef asserts that two pointers reference the same object.
1589  //
1590  //	a.Samef(ptr1, ptr2, "error message %s", "formatted")
1591  //
1592  // Both arguments must be pointer variables. Pointer variable sameness is
1593  // determined based on the equality of both type and value.
1594  func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
1595  	if h, ok := a.t.(tHelper); ok {
1596  		h.Helper()
1597  	}
1598  	return Samef(a.t, expected, actual, msg, args...)
1599  }
1600  
1601  // Subset asserts that the list (array, slice, or map) contains all elements
1602  // given in the subset (array, slice, or map).
1603  // Map elements are key-value pairs unless compared with an array or slice where
1604  // only the map key is evaluated.
1605  //
1606  //	a.Subset([1, 2, 3], [1, 2])
1607  //	a.Subset({"x": 1, "y": 2}, {"x": 1})
1608  //	a.Subset([1, 2, 3], {1: "one", 2: "two"})
1609  //	a.Subset({"x": 1, "y": 2}, ["x"])
1610  func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
1611  	if h, ok := a.t.(tHelper); ok {
1612  		h.Helper()
1613  	}
1614  	return Subset(a.t, list, subset, msgAndArgs...)
1615  }
1616  
1617  // Subsetf asserts that the list (array, slice, or map) contains all elements
1618  // given in the subset (array, slice, or map).
1619  // Map elements are key-value pairs unless compared with an array or slice where
1620  // only the map key is evaluated.
1621  //
1622  //	a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted")
1623  //	a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted")
1624  //	a.Subsetf([1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted")
1625  //	a.Subsetf({"x": 1, "y": 2}, ["x"], "error message %s", "formatted")
1626  func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
1627  	if h, ok := a.t.(tHelper); ok {
1628  		h.Helper()
1629  	}
1630  	return Subsetf(a.t, list, subset, msg, args...)
1631  }
1632  
1633  // True asserts that the specified value is true.
1634  //
1635  //	a.True(myBool)
1636  func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {
1637  	if h, ok := a.t.(tHelper); ok {
1638  		h.Helper()
1639  	}
1640  	return True(a.t, value, msgAndArgs...)
1641  }
1642  
1643  // Truef asserts that the specified value is true.
1644  //
1645  //	a.Truef(myBool, "error message %s", "formatted")
1646  func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {
1647  	if h, ok := a.t.(tHelper); ok {
1648  		h.Helper()
1649  	}
1650  	return Truef(a.t, value, msg, args...)
1651  }
1652  
1653  // WithinDuration asserts that the two times are within duration delta of each other.
1654  //
1655  //	a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
1656  func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {
1657  	if h, ok := a.t.(tHelper); ok {
1658  		h.Helper()
1659  	}
1660  	return WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
1661  }
1662  
1663  // WithinDurationf asserts that the two times are within duration delta of each other.
1664  //
1665  //	a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
1666  func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
1667  	if h, ok := a.t.(tHelper); ok {
1668  		h.Helper()
1669  	}
1670  	return WithinDurationf(a.t, expected, actual, delta, msg, args...)
1671  }
1672  
1673  // WithinRange asserts that a time is within a time range (inclusive).
1674  //
1675  //	a.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))
1676  func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) bool {
1677  	if h, ok := a.t.(tHelper); ok {
1678  		h.Helper()
1679  	}
1680  	return WithinRange(a.t, actual, start, end, msgAndArgs...)
1681  }
1682  
1683  // WithinRangef asserts that a time is within a time range (inclusive).
1684  //
1685  //	a.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted")
1686  func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {
1687  	if h, ok := a.t.(tHelper); ok {
1688  		h.Helper()
1689  	}
1690  	return WithinRangef(a.t, actual, start, end, msg, args...)
1691  }
1692  
1693  // YAMLEq asserts that two YAML strings are equivalent.
1694  func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool {
1695  	if h, ok := a.t.(tHelper); ok {
1696  		h.Helper()
1697  	}
1698  	return YAMLEq(a.t, expected, actual, msgAndArgs...)
1699  }
1700  
1701  // YAMLEqf asserts that two YAML strings are equivalent.
1702  func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) bool {
1703  	if h, ok := a.t.(tHelper); ok {
1704  		h.Helper()
1705  	}
1706  	return YAMLEqf(a.t, expected, actual, msg, args...)
1707  }
1708  
1709  // Zero asserts that i is the zero value for its type.
1710  func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool {
1711  	if h, ok := a.t.(tHelper); ok {
1712  		h.Helper()
1713  	}
1714  	return Zero(a.t, i, msgAndArgs...)
1715  }
1716  
1717  // Zerof asserts that i is the zero value for its type.
1718  func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool {
1719  	if h, ok := a.t.(tHelper); ok {
1720  		h.Helper()
1721  	}
1722  	return Zerof(a.t, i, msg, args...)
1723  }
1724