| 1 | /* |
| 2 | * CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen |
| 3 | * THIS FILE MUST NOT BE EDITED BY HAND |
| 4 | */ |
| 5 | |
| 6 | package assert |
| 7 | |
| 8 | import ( |
| 9 | http "net/http" |
| 10 | url "net/url" |
| 11 | time "time" |
| 12 | |
| 13 | assert "github.com/stretchr/testify/assert" |
| 14 | ) |
| 15 | |
| 16 | // Condition uses a Comparison to assert a complex condition. |
| 17 | func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) { |
| 18 | Condition(a.t, comp, msgAndArgs...) |
| 19 | } |
| 20 | |
| 21 | // Contains asserts that the specified string, list(array, slice...) or map contains the |
| 22 | // specified substring or element. |
| 23 | // |
| 24 | // a.Contains("Hello World", "World") |
| 25 | // a.Contains(["Hello", "World"], "World") |
| 26 | // a.Contains({"Hello": "World"}, "Hello") |
| 27 | func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { |
| 28 | Contains(a.t, s, contains, msgAndArgs...) |
| 29 | } |
| 30 | |
| 31 | // DirExists checks whether a directory exists in the given path. It also fails |
| 32 | // if the path is a file rather a directory or there is an error checking whether it exists. |
| 33 | func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) { |
| 34 | DirExists(a.t, path, msgAndArgs...) |
| 35 | } |
| 36 | |
| 37 | // ElementsMatch asserts that the specified listA(array, slice...) is equal to specified |
| 38 | // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, |
| 39 | // the number of appearances of each of them in both lists should match. |
| 40 | // |
| 41 | // a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]) |
| 42 | func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) { |
| 43 | ElementsMatch(a.t, listA, listB, msgAndArgs...) |
| 44 | } |
| 45 | |
| 46 | // Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either |
| 47 | // a slice or a channel with len == 0. |
| 48 | // |
| 49 | // a.Empty(obj) |
| 50 | func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { |
| 51 | Empty(a.t, object, msgAndArgs...) |
| 52 | } |
| 53 | |
| 54 | // Equal asserts that two objects are equal. |
| 55 | // |
| 56 | // a.Equal(123, 123) |
| 57 | // |
| 58 | // Pointer variable equality is determined based on the equality of the |
| 59 | // referenced values (as opposed to the memory addresses). Function equality |
| 60 | // cannot be determined and will always fail. |
| 61 | func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { |
| 62 | Equal(a.t, expected, actual, msgAndArgs...) |
| 63 | } |
| 64 | |
| 65 | // EqualError asserts that a function returned an error (i.e. not `nil`) |
| 66 | // and that it is equal to the provided error. |
| 67 | // |
| 68 | // actualObj, err := SomeFunction() |
| 69 | // a.EqualError(err, expectedErrorString) |
| 70 | func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) { |
| 71 | EqualError(a.t, theError, errString, msgAndArgs...) |
| 72 | } |
| 73 | |
| 74 | // EqualValues asserts that two objects are equal or convertable to the same types |
| 75 | // and equal. |
| 76 | // |
| 77 | // a.EqualValues(uint32(123), int32(123)) |
| 78 | func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { |
| 79 | EqualValues(a.t, expected, actual, msgAndArgs...) |
| 80 | } |
| 81 | |
| 82 | // Error asserts that a function returned an error (i.e. not `nil`). |
| 83 | // |
| 84 | // actualObj, err := SomeFunction() |
| 85 | // if a.Error(err) { |
| 86 | // assert.Equal(t, expectedError, err) |
| 87 | // } |
| 88 | func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { |
| 89 | Error(a.t, err, msgAndArgs...) |
| 90 | } |
| 91 | |
| 92 | // Eventually asserts that given condition will be met in waitFor time, |
| 93 | // periodically checking target function each tick. |
| 94 | // |
| 95 | // a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond) |
| 96 | func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { |
| 97 | Eventually(a.t, condition, waitFor, tick, msgAndArgs...) |
| 98 | } |
| 99 | |
| 100 | // Exactly asserts that two objects are equal in value and type. |
| 101 | // |
| 102 | // a.Exactly(int32(123), int64(123)) |
| 103 | func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { |
| 104 | Exactly(a.t, expected, actual, msgAndArgs...) |
| 105 | } |
| 106 | |
| 107 | // Fail reports a failure through |
| 108 | func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) { |
| 109 | Fail(a.t, failureMessage, msgAndArgs...) |
| 110 | } |
| 111 | |
| 112 | // FailNow fails test |
| 113 | func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) { |
| 114 | FailNow(a.t, failureMessage, msgAndArgs...) |
| 115 | } |
| 116 | |
| 117 | // False asserts that the specified value is false. |
| 118 | // |
| 119 | // a.False(myBool) |
| 120 | func (a *Assertions) False(value bool, msgAndArgs ...interface{}) { |
| 121 | False(a.t, value, msgAndArgs...) |
| 122 | } |
| 123 | |
| 124 | // FileExists checks whether a file exists in the given path. It also fails if |
| 125 | // the path points to a directory or there is an error when trying to check the file. |
| 126 | func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) { |
| 127 | FileExists(a.t, path, msgAndArgs...) |
| 128 | } |
| 129 | |
| 130 | // Greater asserts that the first element is greater than the second |
| 131 | // |
| 132 | // a.Greater(2, 1) |
| 133 | // a.Greater(float64(2), float64(1)) |
| 134 | // a.Greater("b", "a") |
| 135 | func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { |
| 136 | Greater(a.t, e1, e2, msgAndArgs...) |
| 137 | } |
| 138 | |
| 139 | // GreaterOrEqual asserts that the first element is greater than or equal to the second |
| 140 | // |
| 141 | // a.GreaterOrEqual(2, 1) |
| 142 | // a.GreaterOrEqual(2, 2) |
| 143 | // a.GreaterOrEqual("b", "a") |
| 144 | // a.GreaterOrEqual("b", "b") |
| 145 | func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { |
| 146 | GreaterOrEqual(a.t, e1, e2, msgAndArgs...) |
| 147 | } |
| 148 | |
| 149 | // HTTPBodyContains asserts that a specified handler returns a |
| 150 | // body that contains a string. |
| 151 | // |
| 152 | // a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") |
| 153 | // |
| 154 | // Returns whether the assertion was successful (true) or not (false). |
| 155 | func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { |
| 156 | HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...) |
| 157 | } |
| 158 | |
| 159 | // HTTPBodyNotContains asserts that a specified handler returns a |
| 160 | // body that does not contain a string. |
| 161 | // |
| 162 | // a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") |
| 163 | // |
| 164 | // Returns whether the assertion was successful (true) or not (false). |
| 165 | func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { |
| 166 | HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...) |
| 167 | } |
| 168 | |
| 169 | // HTTPError asserts that a specified handler returns an error status code. |
| 170 | // |
| 171 | // a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} |
| 172 | // |
| 173 | // Returns whether the assertion was successful (true) or not (false). |
| 174 | func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { |
| 175 | HTTPError(a.t, handler, method, url, values, msgAndArgs...) |
| 176 | } |
| 177 | |
| 178 | // HTTPRedirect asserts that a specified handler returns a redirect status code. |
| 179 | // |
| 180 | // a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} |
| 181 | // |
| 182 | // Returns whether the assertion was successful (true) or not (false). |
| 183 | func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { |
| 184 | HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...) |
| 185 | } |
| 186 | |
| 187 | // HTTPStatusCode asserts that a specified handler returns a specified status code. |
| 188 | // |
| 189 | // a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501) |
| 190 | // |
| 191 | // Returns whether the assertion was successful (true) or not (false). |
| 192 | func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) { |
| 193 | HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...) |
| 194 | } |
| 195 | |
| 196 | // HTTPSuccess asserts that a specified handler returns a success status code. |
| 197 | // |
| 198 | // a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) |
| 199 | // |
| 200 | // Returns whether the assertion was successful (true) or not (false). |
| 201 | func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { |
| 202 | HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...) |
| 203 | } |
| 204 | |
| 205 | // Implements asserts that an object is implemented by the specified interface. |
| 206 | // |
| 207 | // a.Implements((*MyInterface)(nil), new(MyObject)) |
| 208 | func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { |
| 209 | Implements(a.t, interfaceObject, object, msgAndArgs...) |
| 210 | } |
| 211 | |
| 212 | // InDelta asserts that the two numerals are within delta of each other. |
| 213 | // |
| 214 | // a.InDelta(math.Pi, 22/7.0, 0.01) |
| 215 | func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { |
| 216 | InDelta(a.t, expected, actual, delta, msgAndArgs...) |
| 217 | } |
| 218 | |
| 219 | // InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. |
| 220 | func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { |
| 221 | InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...) |
| 222 | } |
| 223 | |
| 224 | // InDeltaSlice is the same as InDelta, except it compares two slices. |
| 225 | func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { |
| 226 | InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) |
| 227 | } |
| 228 | |
| 229 | // InEpsilon asserts that expected and actual have a relative error less than epsilon |
| 230 | func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { |
| 231 | InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) |
| 232 | } |
| 233 | |
| 234 | // InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. |
| 235 | func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { |
| 236 | InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...) |
| 237 | } |
| 238 | |
| 239 | // IsType asserts that the specified objects are of the same type. |
| 240 | func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { |
| 241 | IsType(a.t, expectedType, object, msgAndArgs...) |
| 242 | } |
| 243 | |
| 244 | // JSONEq asserts that two JSON strings are equivalent. |
| 245 | // |
| 246 | // a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) |
| 247 | func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) { |
| 248 | JSONEq(a.t, expected, actual, msgAndArgs...) |
| 249 | } |
| 250 | |
| 251 | // Len asserts that the specified object has specific length. |
| 252 | // Len also fails if the object has a type that len() not accept. |
| 253 | // |
| 254 | // a.Len(mySlice, 3) |
| 255 | func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) { |
| 256 | Len(a.t, object, length, msgAndArgs...) |
| 257 | } |
| 258 | |
| 259 | // Less asserts that the first element is less than the second |
| 260 | // |
| 261 | // a.Less(1, 2) |
| 262 | // a.Less(float64(1), float64(2)) |
| 263 | // a.Less("a", "b") |
| 264 | func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { |
| 265 | Less(a.t, e1, e2, msgAndArgs...) |
| 266 | } |
| 267 | |
| 268 | // LessOrEqual asserts that the first element is less than or equal to the second |
| 269 | // |
| 270 | // a.LessOrEqual(1, 2) |
| 271 | // a.LessOrEqual(2, 2) |
| 272 | // a.LessOrEqual("a", "b") |
| 273 | // a.LessOrEqual("b", "b") |
| 274 | func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { |
| 275 | LessOrEqual(a.t, e1, e2, msgAndArgs...) |
| 276 | } |
| 277 | |
| 278 | // Never asserts that the given condition doesn't satisfy in waitFor time, |
| 279 | // periodically checking the target function each tick. |
| 280 | // |
| 281 | // a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond) |
| 282 | func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { |
| 283 | Never(a.t, condition, waitFor, tick, msgAndArgs...) |
| 284 | } |
| 285 | |
| 286 | // Nil asserts that the specified object is nil. |
| 287 | // |
| 288 | // a.Nil(err) |
| 289 | func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) { |
| 290 | Nil(a.t, object, msgAndArgs...) |
| 291 | } |
| 292 | |
| 293 | // NoDirExists checks whether a directory does not exist in the given path. |
| 294 | // It fails if the path points to an existing _directory_ only. |
| 295 | func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) { |
| 296 | NoDirExists(a.t, path, msgAndArgs...) |
| 297 | } |
| 298 | |
| 299 | // NoError asserts that a function returned no error (i.e. `nil`). |
| 300 | // |
| 301 | // actualObj, err := SomeFunction() |
| 302 | // if a.NoError(err) { |
| 303 | // assert.Equal(t, expectedObj, actualObj) |
| 304 | // } |
| 305 | func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) { |
| 306 | NoError(a.t, err, msgAndArgs...) |
| 307 | } |
| 308 | |
| 309 | // NoFileExists checks whether a file does not exist in a given path. It fails |
| 310 | // if the path points to an existing _file_ only. |
| 311 | func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) { |
| 312 | NoFileExists(a.t, path, msgAndArgs...) |
| 313 | } |
| 314 | |
| 315 | // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the |
| 316 | // specified substring or element. |
| 317 | // |
| 318 | // a.NotContains("Hello World", "Earth") |
| 319 | // a.NotContains(["Hello", "World"], "Earth") |
| 320 | // a.NotContains({"Hello": "World"}, "Earth") |
| 321 | func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { |
| 322 | NotContains(a.t, s, contains, msgAndArgs...) |
| 323 | } |
| 324 | |
| 325 | // NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either |
| 326 | // a slice or a channel with len == 0. |
| 327 | // |
| 328 | // if a.NotEmpty(obj) { |
| 329 | // assert.Equal(t, "two", obj[1]) |
| 330 | // } |
| 331 | func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { |
| 332 | NotEmpty(a.t, object, msgAndArgs...) |
| 333 | } |
| 334 | |
| 335 | // NotEqual asserts that the specified values are NOT equal. |
| 336 | // |
| 337 | // a.NotEqual(obj1, obj2) |
| 338 | // |
| 339 | // Pointer variable equality is determined based on the equality of the |
| 340 | // referenced values (as opposed to the memory addresses). |
| 341 | func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { |
| 342 | NotEqual(a.t, expected, actual, msgAndArgs...) |
| 343 | } |
| 344 | |
| 345 | // NotEqualValues asserts that two objects are not equal even when converted to the same type |
| 346 | // |
| 347 | // a.NotEqualValues(obj1, obj2) |
| 348 | func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { |
| 349 | NotEqualValues(a.t, expected, actual, msgAndArgs...) |
| 350 | } |
| 351 | |
| 352 | // NotNil asserts that the specified object is not nil. |
| 353 | // |
| 354 | // a.NotNil(err) |
| 355 | func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) { |
| 356 | NotNil(a.t, object, msgAndArgs...) |
| 357 | } |
| 358 | |
| 359 | // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. |
| 360 | // |
| 361 | // a.NotPanics(func(){ RemainCalm() }) |
| 362 | func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { |
| 363 | NotPanics(a.t, f, msgAndArgs...) |
| 364 | } |
| 365 | |
| 366 | // NotRegexp asserts that a specified regexp does not match a string. |
| 367 | // |
| 368 | // a.NotRegexp(regexp.MustCompile("starts"), "it's starting") |
| 369 | // a.NotRegexp("^start", "it's not starting") |
| 370 | func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { |
| 371 | NotRegexp(a.t, rx, str, msgAndArgs...) |
| 372 | } |
| 373 | |
| 374 | // NotSame asserts that two pointers do not reference the same object. |
| 375 | // |
| 376 | // a.NotSame(ptr1, ptr2) |
| 377 | // |
| 378 | // Both arguments must be pointer variables. Pointer variable sameness is |
| 379 | // determined based on the equality of both type and value. |
| 380 | func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { |
| 381 | NotSame(a.t, expected, actual, msgAndArgs...) |
| 382 | } |
| 383 | |
| 384 | // NotSubset asserts that the specified list(array, slice...) contains not all |
| 385 | // elements given in the specified subset(array, slice...). |
| 386 | // |
| 387 | // a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") |
| 388 | func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { |
| 389 | NotSubset(a.t, list, subset, msgAndArgs...) |
| 390 | } |
| 391 | |
| 392 | // NotZero asserts that i is not the zero value for its type. |
| 393 | func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) { |
| 394 | NotZero(a.t, i, msgAndArgs...) |
| 395 | } |
| 396 | |
| 397 | // Panics asserts that the code inside the specified PanicTestFunc panics. |
| 398 | // |
| 399 | // a.Panics(func(){ GoCrazy() }) |
| 400 | func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { |
| 401 | Panics(a.t, f, msgAndArgs...) |
| 402 | } |
| 403 | |
| 404 | // PanicsWithError asserts that the code inside the specified PanicTestFunc |
| 405 | // panics, and that the recovered panic value is an error that satisfies the |
| 406 | // EqualError comparison. |
| 407 | // |
| 408 | // a.PanicsWithError("crazy error", func(){ GoCrazy() }) |
| 409 | func (a *Assertions) PanicsWithError(errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) { |
| 410 | PanicsWithError(a.t, errString, f, msgAndArgs...) |
| 411 | } |
| 412 | |
| 413 | // PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that |
| 414 | // the recovered panic value equals the expected panic value. |
| 415 | // |
| 416 | // a.PanicsWithValue("crazy error", func(){ GoCrazy() }) |
| 417 | func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) { |
| 418 | PanicsWithValue(a.t, expected, f, msgAndArgs...) |
| 419 | } |
| 420 | |
| 421 | // Regexp asserts that a specified regexp matches a string. |
| 422 | // |
| 423 | // a.Regexp(regexp.MustCompile("start"), "it's starting") |
| 424 | // a.Regexp("start...$", "it's not starting") |
| 425 | func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { |
| 426 | Regexp(a.t, rx, str, msgAndArgs...) |
| 427 | } |
| 428 | |
| 429 | // Same asserts that two pointers reference the same object. |
| 430 | // |
| 431 | // a.Same(ptr1, ptr2) |
| 432 | // |
| 433 | // Both arguments must be pointer variables. Pointer variable sameness is |
| 434 | // determined based on the equality of both type and value. |
| 435 | func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { |
| 436 | Same(a.t, expected, actual, msgAndArgs...) |
| 437 | } |
| 438 | |
| 439 | // Subset asserts that the specified list(array, slice...) contains all |
| 440 | // elements given in the specified subset(array, slice...). |
| 441 | // |
| 442 | // a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") |
| 443 | func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { |
| 444 | Subset(a.t, list, subset, msgAndArgs...) |
| 445 | } |
| 446 | |
| 447 | // True asserts that the specified value is true. |
| 448 | // |
| 449 | // a.True(myBool) |
| 450 | func (a *Assertions) True(value bool, msgAndArgs ...interface{}) { |
| 451 | True(a.t, value, msgAndArgs...) |
| 452 | } |
| 453 | |
| 454 | // WithinDuration asserts that the two times are within duration delta of each other. |
| 455 | // |
| 456 | // a.WithinDuration(time.Now(), time.Now(), 10*time.Second) |
| 457 | func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { |
| 458 | WithinDuration(a.t, expected, actual, delta, msgAndArgs...) |
| 459 | } |
| 460 | |
| 461 | // YAMLEq asserts that two YAML strings are equivalent. |
| 462 | func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) { |
| 463 | YAMLEq(a.t, expected, actual, msgAndArgs...) |
| 464 | } |
| 465 | |
| 466 | // Zero asserts that i is the zero value for its type. |
| 467 | func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) { |
| 468 | Zero(a.t, i, msgAndArgs...) |
| 469 | } |