...

Source file src/github.com/stretchr/testify/require/require_forward.go

Documentation: github.com/stretchr/testify/require

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

View as plain text