1/* 2* CODE GENERATED AUTOMATICALLY WITH github.com/ooni/psiphon/oopsi/github.com/stretchr/testify/_codegen 3* THIS FILE MUST NOT BE EDITED BY HAND 4 */ 5 6package require 7 8import ( 9 assert "github.com/ooni/psiphon/oopsi/github.com/stretchr/testify/assert" 10 http "net/http" 11 url "net/url" 12 time "time" 13) 14 15// Condition uses a Comparison to assert a complex condition. 16func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) { 17 Condition(a.t, comp, msgAndArgs...) 18} 19 20// Conditionf uses a Comparison to assert a complex condition. 21func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) { 22 Conditionf(a.t, comp, msg, args...) 23} 24 25// Contains asserts that the specified string, list(array, slice...) or map contains the 26// specified substring or element. 27// 28// a.Contains("Hello World", "World") 29// a.Contains(["Hello", "World"], "World") 30// a.Contains({"Hello": "World"}, "Hello") 31// 32// Returns whether the assertion was successful (true) or not (false). 33func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { 34 Contains(a.t, s, contains, msgAndArgs...) 35} 36 37// Containsf asserts that the specified string, list(array, slice...) or map contains the 38// specified substring or element. 39// 40// a.Containsf("Hello World", "World", "error message %s", "formatted") 41// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted") 42// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted") 43// 44// Returns whether the assertion was successful (true) or not (false). 45func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) { 46 Containsf(a.t, s, contains, msg, args...) 47} 48 49// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either 50// a slice or a channel with len == 0. 51// 52// a.Empty(obj) 53// 54// Returns whether the assertion was successful (true) or not (false). 55func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { 56 Empty(a.t, object, msgAndArgs...) 57} 58 59// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either 60// a slice or a channel with len == 0. 61// 62// a.Emptyf(obj, "error message %s", "formatted") 63// 64// Returns whether the assertion was successful (true) or not (false). 65func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) { 66 Emptyf(a.t, object, msg, args...) 67} 68 69// Equal asserts that two objects are equal. 70// 71// a.Equal(123, 123) 72// 73// Returns whether the assertion was successful (true) or not (false). 74// 75// Pointer variable equality is determined based on the equality of the 76// referenced values (as opposed to the memory addresses). Function equality 77// cannot be determined and will always fail. 78func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { 79 Equal(a.t, expected, actual, msgAndArgs...) 80} 81 82// EqualError asserts that a function returned an error (i.e. not `nil`) 83// and that it is equal to the provided error. 84// 85// actualObj, err := SomeFunction() 86// a.EqualError(err, expectedErrorString) 87// 88// Returns whether the assertion was successful (true) or not (false). 89func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) { 90 EqualError(a.t, theError, errString, msgAndArgs...) 91} 92 93// EqualErrorf asserts that a function returned an error (i.e. not `nil`) 94// and that it is equal to the provided error. 95// 96// actualObj, err := SomeFunction() 97// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted") 98// 99// Returns whether the assertion was successful (true) or not (false). 100func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) { 101 EqualErrorf(a.t, theError, errString, msg, args...) 102} 103 104// EqualValues asserts that two objects are equal or convertable to the same types 105// and equal. 106// 107// a.EqualValues(uint32(123), int32(123)) 108// 109// Returns whether the assertion was successful (true) or not (false). 110func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { 111 EqualValues(a.t, expected, actual, msgAndArgs...) 112} 113 114// EqualValuesf asserts that two objects are equal or convertable to the same types 115// and equal. 116// 117// a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123)) 118// 119// Returns whether the assertion was successful (true) or not (false). 120func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) { 121 EqualValuesf(a.t, expected, actual, msg, args...) 122} 123 124// Equalf asserts that two objects are equal. 125// 126// a.Equalf(123, 123, "error message %s", "formatted") 127// 128// Returns whether the assertion was successful (true) or not (false). 129// 130// Pointer variable equality is determined based on the equality of the 131// referenced values (as opposed to the memory addresses). Function equality 132// cannot be determined and will always fail. 133func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) { 134 Equalf(a.t, expected, actual, msg, args...) 135} 136 137// Error asserts that a function returned an error (i.e. not `nil`). 138// 139// actualObj, err := SomeFunction() 140// if a.Error(err) { 141// assert.Equal(t, expectedError, err) 142// } 143// 144// Returns whether the assertion was successful (true) or not (false). 145func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { 146 Error(a.t, err, msgAndArgs...) 147} 148 149// Errorf asserts that a function returned an error (i.e. not `nil`). 150// 151// actualObj, err := SomeFunction() 152// if a.Errorf(err, "error message %s", "formatted") { 153// assert.Equal(t, expectedErrorf, err) 154// } 155// 156// Returns whether the assertion was successful (true) or not (false). 157func (a *Assertions) Errorf(err error, msg string, args ...interface{}) { 158 Errorf(a.t, err, msg, args...) 159} 160 161// Exactly asserts that two objects are equal is value and type. 162// 163// a.Exactly(int32(123), int64(123)) 164// 165// Returns whether the assertion was successful (true) or not (false). 166func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { 167 Exactly(a.t, expected, actual, msgAndArgs...) 168} 169 170// Exactlyf asserts that two objects are equal is value and type. 171// 172// a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123)) 173// 174// Returns whether the assertion was successful (true) or not (false). 175func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) { 176 Exactlyf(a.t, expected, actual, msg, args...) 177} 178 179// Fail reports a failure through 180func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) { 181 Fail(a.t, failureMessage, msgAndArgs...) 182} 183 184// FailNow fails test 185func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) { 186 FailNow(a.t, failureMessage, msgAndArgs...) 187} 188 189// FailNowf fails test 190func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) { 191 FailNowf(a.t, failureMessage, msg, args...) 192} 193 194// Failf reports a failure through 195func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) { 196 Failf(a.t, failureMessage, msg, args...) 197} 198 199// False asserts that the specified value is false. 200// 201// a.False(myBool) 202// 203// Returns whether the assertion was successful (true) or not (false). 204func (a *Assertions) False(value bool, msgAndArgs ...interface{}) { 205 False(a.t, value, msgAndArgs...) 206} 207 208// Falsef asserts that the specified value is false. 209// 210// a.Falsef(myBool, "error message %s", "formatted") 211// 212// Returns whether the assertion was successful (true) or not (false). 213func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) { 214 Falsef(a.t, value, msg, args...) 215} 216 217// HTTPBodyContains asserts that a specified handler returns a 218// body that contains a string. 219// 220// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") 221// 222// Returns whether the assertion was successful (true) or not (false). 223func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { 224 HTTPBodyContains(a.t, handler, method, url, values, str) 225} 226 227// HTTPBodyContainsf asserts that a specified handler returns a 228// body that contains a string. 229// 230// a.HTTPBodyContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") 231// 232// Returns whether the assertion was successful (true) or not (false). 233func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { 234 HTTPBodyContainsf(a.t, handler, method, url, values, str) 235} 236 237// HTTPBodyNotContains asserts that a specified handler returns a 238// body that does not contain a string. 239// 240// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") 241// 242// Returns whether the assertion was successful (true) or not (false). 243func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { 244 HTTPBodyNotContains(a.t, handler, method, url, values, str) 245} 246 247// HTTPBodyNotContainsf asserts that a specified handler returns a 248// body that does not contain a string. 249// 250// a.HTTPBodyNotContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") 251// 252// Returns whether the assertion was successful (true) or not (false). 253func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { 254 HTTPBodyNotContainsf(a.t, handler, method, url, values, str) 255} 256 257// HTTPError asserts that a specified handler returns an error status code. 258// 259// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} 260// 261// Returns whether the assertion was successful (true) or not (false). 262func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) { 263 HTTPError(a.t, handler, method, url, values) 264} 265 266// HTTPErrorf asserts that a specified handler returns an error status code. 267// 268// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} 269// 270// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). 271func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values) { 272 HTTPErrorf(a.t, handler, method, url, values) 273} 274 275// HTTPRedirect asserts that a specified handler returns a redirect status code. 276// 277// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} 278// 279// Returns whether the assertion was successful (true) or not (false). 280func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) { 281 HTTPRedirect(a.t, handler, method, url, values) 282} 283 284// HTTPRedirectf asserts that a specified handler returns a redirect status code. 285// 286// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} 287// 288// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). 289func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values) { 290 HTTPRedirectf(a.t, handler, method, url, values) 291} 292 293// HTTPSuccess asserts that a specified handler returns a success status code. 294// 295// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) 296// 297// Returns whether the assertion was successful (true) or not (false). 298func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) { 299 HTTPSuccess(a.t, handler, method, url, values) 300} 301 302// HTTPSuccessf asserts that a specified handler returns a success status code. 303// 304// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") 305// 306// Returns whether the assertion was successful (true) or not (false). 307func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values) { 308 HTTPSuccessf(a.t, handler, method, url, values) 309} 310 311// Implements asserts that an object is implemented by the specified interface. 312// 313// a.Implements((*MyInterface)(nil), new(MyObject)) 314func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { 315 Implements(a.t, interfaceObject, object, msgAndArgs...) 316} 317 318// Implementsf asserts that an object is implemented by the specified interface. 319// 320// a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject)) 321func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { 322 Implementsf(a.t, interfaceObject, object, msg, args...) 323} 324 325// InDelta asserts that the two numerals are within delta of each other. 326// 327// a.InDelta(math.Pi, (22 / 7.0), 0.01) 328// 329// Returns whether the assertion was successful (true) or not (false). 330func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { 331 InDelta(a.t, expected, actual, delta, msgAndArgs...) 332} 333 334// InDeltaSlice is the same as InDelta, except it compares two slices. 335func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { 336 InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) 337} 338 339// InDeltaSlicef is the same as InDelta, except it compares two slices. 340func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { 341 InDeltaSlicef(a.t, expected, actual, delta, msg, args...) 342} 343 344// InDeltaf asserts that the two numerals are within delta of each other. 345// 346// a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01) 347// 348// Returns whether the assertion was successful (true) or not (false). 349func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { 350 InDeltaf(a.t, expected, actual, delta, msg, args...) 351} 352 353// InEpsilon asserts that expected and actual have a relative error less than epsilon 354// 355// Returns whether the assertion was successful (true) or not (false). 356func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { 357 InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) 358} 359 360// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. 361func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { 362 InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...) 363} 364 365// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. 366func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { 367 InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...) 368} 369 370// InEpsilonf asserts that expected and actual have a relative error less than epsilon 371// 372// Returns whether the assertion was successful (true) or not (false). 373func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { 374 InEpsilonf(a.t, expected, actual, epsilon, msg, args...) 375} 376 377// IsType asserts that the specified objects are of the same type. 378func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { 379 IsType(a.t, expectedType, object, msgAndArgs...) 380} 381 382// IsTypef asserts that the specified objects are of the same type. 383func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) { 384 IsTypef(a.t, expectedType, object, msg, args...) 385} 386 387// JSONEq asserts that two JSON strings are equivalent. 388// 389// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) 390// 391// Returns whether the assertion was successful (true) or not (false). 392func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) { 393 JSONEq(a.t, expected, actual, msgAndArgs...) 394} 395 396// JSONEqf asserts that two JSON strings are equivalent. 397// 398// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") 399// 400// Returns whether the assertion was successful (true) or not (false). 401func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) { 402 JSONEqf(a.t, expected, actual, msg, args...) 403} 404 405// Len asserts that the specified object has specific length. 406// Len also fails if the object has a type that len() not accept. 407// 408// a.Len(mySlice, 3) 409// 410// Returns whether the assertion was successful (true) or not (false). 411func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) { 412 Len(a.t, object, length, msgAndArgs...) 413} 414 415// Lenf asserts that the specified object has specific length. 416// Lenf also fails if the object has a type that len() not accept. 417// 418// a.Lenf(mySlice, 3, "error message %s", "formatted") 419// 420// Returns whether the assertion was successful (true) or not (false). 421func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) { 422 Lenf(a.t, object, length, msg, args...) 423} 424 425// Nil asserts that the specified object is nil. 426// 427// a.Nil(err) 428// 429// Returns whether the assertion was successful (true) or not (false). 430func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) { 431 Nil(a.t, object, msgAndArgs...) 432} 433 434// Nilf asserts that the specified object is nil. 435// 436// a.Nilf(err, "error message %s", "formatted") 437// 438// Returns whether the assertion was successful (true) or not (false). 439func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) { 440 Nilf(a.t, object, msg, args...) 441} 442 443// NoError asserts that a function returned no error (i.e. `nil`). 444// 445// actualObj, err := SomeFunction() 446// if a.NoError(err) { 447// assert.Equal(t, expectedObj, actualObj) 448// } 449// 450// Returns whether the assertion was successful (true) or not (false). 451func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) { 452 NoError(a.t, err, msgAndArgs...) 453} 454 455// NoErrorf asserts that a function returned no error (i.e. `nil`). 456// 457// actualObj, err := SomeFunction() 458// if a.NoErrorf(err, "error message %s", "formatted") { 459// assert.Equal(t, expectedObj, actualObj) 460// } 461// 462// Returns whether the assertion was successful (true) or not (false). 463func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) { 464 NoErrorf(a.t, err, msg, args...) 465} 466 467// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the 468// specified substring or element. 469// 470// a.NotContains("Hello World", "Earth") 471// a.NotContains(["Hello", "World"], "Earth") 472// a.NotContains({"Hello": "World"}, "Earth") 473// 474// Returns whether the assertion was successful (true) or not (false). 475func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { 476 NotContains(a.t, s, contains, msgAndArgs...) 477} 478 479// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the 480// specified substring or element. 481// 482// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted") 483// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted") 484// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted") 485// 486// Returns whether the assertion was successful (true) or not (false). 487func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) { 488 NotContainsf(a.t, s, contains, msg, args...) 489} 490 491// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either 492// a slice or a channel with len == 0. 493// 494// if a.NotEmpty(obj) { 495// assert.Equal(t, "two", obj[1]) 496// } 497// 498// Returns whether the assertion was successful (true) or not (false). 499func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { 500 NotEmpty(a.t, object, msgAndArgs...) 501} 502 503// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either 504// a slice or a channel with len == 0. 505// 506// if a.NotEmptyf(obj, "error message %s", "formatted") { 507// assert.Equal(t, "two", obj[1]) 508// } 509// 510// Returns whether the assertion was successful (true) or not (false). 511func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) { 512 NotEmptyf(a.t, object, msg, args...) 513} 514 515// NotEqual asserts that the specified values are NOT equal. 516// 517// a.NotEqual(obj1, obj2) 518// 519// Returns whether the assertion was successful (true) or not (false). 520// 521// Pointer variable equality is determined based on the equality of the 522// referenced values (as opposed to the memory addresses). 523func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { 524 NotEqual(a.t, expected, actual, msgAndArgs...) 525} 526 527// NotEqualf asserts that the specified values are NOT equal. 528// 529// a.NotEqualf(obj1, obj2, "error message %s", "formatted") 530// 531// Returns whether the assertion was successful (true) or not (false). 532// 533// Pointer variable equality is determined based on the equality of the 534// referenced values (as opposed to the memory addresses). 535func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) { 536 NotEqualf(a.t, expected, actual, msg, args...) 537} 538 539// NotNil asserts that the specified object is not nil. 540// 541// a.NotNil(err) 542// 543// Returns whether the assertion was successful (true) or not (false). 544func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) { 545 NotNil(a.t, object, msgAndArgs...) 546} 547 548// NotNilf asserts that the specified object is not nil. 549// 550// a.NotNilf(err, "error message %s", "formatted") 551// 552// Returns whether the assertion was successful (true) or not (false). 553func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) { 554 NotNilf(a.t, object, msg, args...) 555} 556 557// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. 558// 559// a.NotPanics(func(){ RemainCalm() }) 560// 561// Returns whether the assertion was successful (true) or not (false). 562func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { 563 NotPanics(a.t, f, msgAndArgs...) 564} 565 566// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. 567// 568// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted") 569// 570// Returns whether the assertion was successful (true) or not (false). 571func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) { 572 NotPanicsf(a.t, f, msg, args...) 573} 574 575// NotRegexp asserts that a specified regexp does not match a string. 576// 577// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") 578// a.NotRegexp("^start", "it's not starting") 579// 580// Returns whether the assertion was successful (true) or not (false). 581func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { 582 NotRegexp(a.t, rx, str, msgAndArgs...) 583} 584 585// NotRegexpf asserts that a specified regexp does not match a string. 586// 587// a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting") 588// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted") 589// 590// Returns whether the assertion was successful (true) or not (false). 591func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) { 592 NotRegexpf(a.t, rx, str, msg, args...) 593} 594 595// NotSubset asserts that the specified list(array, slice...) contains not all 596// elements given in the specified subset(array, slice...). 597// 598// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") 599// 600// Returns whether the assertion was successful (true) or not (false). 601func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { 602 NotSubset(a.t, list, subset, msgAndArgs...) 603} 604 605// NotSubsetf asserts that the specified list(array, slice...) contains not all 606// elements given in the specified subset(array, slice...). 607// 608// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") 609// 610// Returns whether the assertion was successful (true) or not (false). 611func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { 612 NotSubsetf(a.t, list, subset, msg, args...) 613} 614 615// NotZero asserts that i is not the zero value for its type and returns the truth. 616func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) { 617 NotZero(a.t, i, msgAndArgs...) 618} 619 620// NotZerof asserts that i is not the zero value for its type and returns the truth. 621func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) { 622 NotZerof(a.t, i, msg, args...) 623} 624 625// Panics asserts that the code inside the specified PanicTestFunc panics. 626// 627// a.Panics(func(){ GoCrazy() }) 628// 629// Returns whether the assertion was successful (true) or not (false). 630func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { 631 Panics(a.t, f, msgAndArgs...) 632} 633 634// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that 635// the recovered panic value equals the expected panic value. 636// 637// a.PanicsWithValue("crazy error", func(){ GoCrazy() }) 638// 639// Returns whether the assertion was successful (true) or not (false). 640func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) { 641 PanicsWithValue(a.t, expected, f, msgAndArgs...) 642} 643 644// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that 645// the recovered panic value equals the expected panic value. 646// 647// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") 648// 649// Returns whether the assertion was successful (true) or not (false). 650func (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) { 651 PanicsWithValuef(a.t, expected, f, msg, args...) 652} 653 654// Panicsf asserts that the code inside the specified PanicTestFunc panics. 655// 656// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted") 657// 658// Returns whether the assertion was successful (true) or not (false). 659func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) { 660 Panicsf(a.t, f, msg, args...) 661} 662 663// Regexp asserts that a specified regexp matches a string. 664// 665// a.Regexp(regexp.MustCompile("start"), "it's starting") 666// a.Regexp("start...$", "it's not starting") 667// 668// Returns whether the assertion was successful (true) or not (false). 669func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { 670 Regexp(a.t, rx, str, msgAndArgs...) 671} 672 673// Regexpf asserts that a specified regexp matches a string. 674// 675// a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting") 676// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted") 677// 678// Returns whether the assertion was successful (true) or not (false). 679func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) { 680 Regexpf(a.t, rx, str, msg, args...) 681} 682 683// Subset asserts that the specified list(array, slice...) contains all 684// elements given in the specified subset(array, slice...). 685// 686// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") 687// 688// Returns whether the assertion was successful (true) or not (false). 689func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { 690 Subset(a.t, list, subset, msgAndArgs...) 691} 692 693// Subsetf asserts that the specified list(array, slice...) contains all 694// elements given in the specified subset(array, slice...). 695// 696// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") 697// 698// Returns whether the assertion was successful (true) or not (false). 699func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { 700 Subsetf(a.t, list, subset, msg, args...) 701} 702 703// True asserts that the specified value is true. 704// 705// a.True(myBool) 706// 707// Returns whether the assertion was successful (true) or not (false). 708func (a *Assertions) True(value bool, msgAndArgs ...interface{}) { 709 True(a.t, value, msgAndArgs...) 710} 711 712// Truef asserts that the specified value is true. 713// 714// a.Truef(myBool, "error message %s", "formatted") 715// 716// Returns whether the assertion was successful (true) or not (false). 717func (a *Assertions) Truef(value bool, msg string, args ...interface{}) { 718 Truef(a.t, value, msg, args...) 719} 720 721// WithinDuration asserts that the two times are within duration delta of each other. 722// 723// a.WithinDuration(time.Now(), time.Now(), 10*time.Second) 724// 725// Returns whether the assertion was successful (true) or not (false). 726func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { 727 WithinDuration(a.t, expected, actual, delta, msgAndArgs...) 728} 729 730// WithinDurationf asserts that the two times are within duration delta of each other. 731// 732// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") 733// 734// Returns whether the assertion was successful (true) or not (false). 735func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) { 736 WithinDurationf(a.t, expected, actual, delta, msg, args...) 737} 738 739// Zero asserts that i is the zero value for its type and returns the truth. 740func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) { 741 Zero(a.t, i, msgAndArgs...) 742} 743 744// Zerof asserts that i is the zero value for its type and returns the truth. 745func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) { 746 Zerof(a.t, i, msg, args...) 747} 748