OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / stretchr / testify / assert / assertion_format.go
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
14 // Conditionf uses a Comparison to assert a complex condition.
15 func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {
16         return Condition(t, comp, append([]interface{}{msg}, args...)...)
17 }
18
19 // Containsf asserts that the specified string, list(array, slice...) or map contains the
20 // specified substring or element.
21 //
22 //    assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
23 //    assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
24 //    assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
25 //
26 // Returns whether the assertion was successful (true) or not (false).
27 func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
28         return Contains(t, s, contains, append([]interface{}{msg}, args...)...)
29 }
30
31 // Emptyf asserts that the specified object is empty.  I.e. nil, "", false, 0 or either
32 // a slice or a channel with len == 0.
33 //
34 //  assert.Emptyf(t, obj, "error message %s", "formatted")
35 //
36 // Returns whether the assertion was successful (true) or not (false).
37 func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
38         return Empty(t, object, append([]interface{}{msg}, args...)...)
39 }
40
41 // Equalf asserts that two objects are equal.
42 //
43 //    assert.Equalf(t, 123, 123, "error message %s", "formatted")
44 //
45 // Returns whether the assertion was successful (true) or not (false).
46 //
47 // Pointer variable equality is determined based on the equality of the
48 // referenced values (as opposed to the memory addresses). Function equality
49 // cannot be determined and will always fail.
50 func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
51         return Equal(t, expected, actual, append([]interface{}{msg}, args...)...)
52 }
53
54 // EqualErrorf asserts that a function returned an error (i.e. not `nil`)
55 // and that it is equal to the provided error.
56 //
57 //   actualObj, err := SomeFunction()
58 //   assert.EqualErrorf(t, err,  expectedErrorString, "error message %s", "formatted")
59 //
60 // Returns whether the assertion was successful (true) or not (false).
61 func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool {
62         return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)
63 }
64
65 // EqualValuesf asserts that two objects are equal or convertable to the same types
66 // and equal.
67 //
68 //    assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
69 //
70 // Returns whether the assertion was successful (true) or not (false).
71 func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
72         return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
73 }
74
75 // Errorf asserts that a function returned an error (i.e. not `nil`).
76 //
77 //   actualObj, err := SomeFunction()
78 //   if assert.Errorf(t, err, "error message %s", "formatted") {
79 //         assert.Equal(t, expectedErrorf, err)
80 //   }
81 //
82 // Returns whether the assertion was successful (true) or not (false).
83 func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
84         return Error(t, err, append([]interface{}{msg}, args...)...)
85 }
86
87 // Exactlyf asserts that two objects are equal is value and type.
88 //
89 //    assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
90 //
91 // Returns whether the assertion was successful (true) or not (false).
92 func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
93         return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)
94 }
95
96 // Failf reports a failure through
97 func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
98         return Fail(t, failureMessage, append([]interface{}{msg}, args...)...)
99 }
100
101 // FailNowf fails test
102 func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
103         return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...)
104 }
105
106 // Falsef asserts that the specified value is false.
107 //
108 //    assert.Falsef(t, myBool, "error message %s", "formatted")
109 //
110 // Returns whether the assertion was successful (true) or not (false).
111 func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {
112         return False(t, value, append([]interface{}{msg}, args...)...)
113 }
114
115 // HTTPBodyContainsf asserts that a specified handler returns a
116 // body that contains a string.
117 //
118 //  assert.HTTPBodyContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
119 //
120 // Returns whether the assertion was successful (true) or not (false).
121 func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool {
122         return HTTPBodyContains(t, handler, method, url, values, str)
123 }
124
125 // HTTPBodyNotContainsf asserts that a specified handler returns a
126 // body that does not contain a string.
127 //
128 //  assert.HTTPBodyNotContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
129 //
130 // Returns whether the assertion was successful (true) or not (false).
131 func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool {
132         return HTTPBodyNotContains(t, handler, method, url, values, str)
133 }
134
135 // HTTPErrorf asserts that a specified handler returns an error status code.
136 //
137 //  assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
138 //
139 // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
140 func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) bool {
141         return HTTPError(t, handler, method, url, values)
142 }
143
144 // HTTPRedirectf asserts that a specified handler returns a redirect status code.
145 //
146 //  assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
147 //
148 // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
149 func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) bool {
150         return HTTPRedirect(t, handler, method, url, values)
151 }
152
153 // HTTPSuccessf asserts that a specified handler returns a success status code.
154 //
155 //  assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
156 //
157 // Returns whether the assertion was successful (true) or not (false).
158 func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) bool {
159         return HTTPSuccess(t, handler, method, url, values)
160 }
161
162 // Implementsf asserts that an object is implemented by the specified interface.
163 //
164 //    assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
165 func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
166         return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)
167 }
168
169 // InDeltaf asserts that the two numerals are within delta of each other.
170 //
171 //       assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
172 //
173 // Returns whether the assertion was successful (true) or not (false).
174 func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
175         return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
176 }
177
178 // InDeltaSlicef is the same as InDelta, except it compares two slices.
179 func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
180         return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
181 }
182
183 // InEpsilonf asserts that expected and actual have a relative error less than epsilon
184 //
185 // Returns whether the assertion was successful (true) or not (false).
186 func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
187         return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
188 }
189
190 // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
191 func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
192         return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
193 }
194
195 // IsTypef asserts that the specified objects are of the same type.
196 func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
197         return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)
198 }
199
200 // JSONEqf asserts that two JSON strings are equivalent.
201 //
202 //  assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
203 //
204 // Returns whether the assertion was successful (true) or not (false).
205 func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
206         return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)
207 }
208
209 // Lenf asserts that the specified object has specific length.
210 // Lenf also fails if the object has a type that len() not accept.
211 //
212 //    assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
213 //
214 // Returns whether the assertion was successful (true) or not (false).
215 func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {
216         return Len(t, object, length, append([]interface{}{msg}, args...)...)
217 }
218
219 // Nilf asserts that the specified object is nil.
220 //
221 //    assert.Nilf(t, err, "error message %s", "formatted")
222 //
223 // Returns whether the assertion was successful (true) or not (false).
224 func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
225         return Nil(t, object, append([]interface{}{msg}, args...)...)
226 }
227
228 // NoErrorf asserts that a function returned no error (i.e. `nil`).
229 //
230 //   actualObj, err := SomeFunction()
231 //   if assert.NoErrorf(t, err, "error message %s", "formatted") {
232 //         assert.Equal(t, expectedObj, actualObj)
233 //   }
234 //
235 // Returns whether the assertion was successful (true) or not (false).
236 func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {
237         return NoError(t, err, append([]interface{}{msg}, args...)...)
238 }
239
240 // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
241 // specified substring or element.
242 //
243 //    assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
244 //    assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
245 //    assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
246 //
247 // Returns whether the assertion was successful (true) or not (false).
248 func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
249         return NotContains(t, s, contains, append([]interface{}{msg}, args...)...)
250 }
251
252 // NotEmptyf asserts that the specified object is NOT empty.  I.e. not nil, "", false, 0 or either
253 // a slice or a channel with len == 0.
254 //
255 //  if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
256 //    assert.Equal(t, "two", obj[1])
257 //  }
258 //
259 // Returns whether the assertion was successful (true) or not (false).
260 func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
261         return NotEmpty(t, object, append([]interface{}{msg}, args...)...)
262 }
263
264 // NotEqualf asserts that the specified values are NOT equal.
265 //
266 //    assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
267 //
268 // Returns whether the assertion was successful (true) or not (false).
269 //
270 // Pointer variable equality is determined based on the equality of the
271 // referenced values (as opposed to the memory addresses).
272 func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
273         return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)
274 }
275
276 // NotNilf asserts that the specified object is not nil.
277 //
278 //    assert.NotNilf(t, err, "error message %s", "formatted")
279 //
280 // Returns whether the assertion was successful (true) or not (false).
281 func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
282         return NotNil(t, object, append([]interface{}{msg}, args...)...)
283 }
284
285 // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
286 //
287 //   assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
288 //
289 // Returns whether the assertion was successful (true) or not (false).
290 func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
291         return NotPanics(t, f, append([]interface{}{msg}, args...)...)
292 }
293
294 // NotRegexpf asserts that a specified regexp does not match a string.
295 //
296 //  assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
297 //  assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
298 //
299 // Returns whether the assertion was successful (true) or not (false).
300 func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
301         return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)
302 }
303
304 // NotSubsetf asserts that the specified list(array, slice...) contains not all
305 // elements given in the specified subset(array, slice...).
306 //
307 //    assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
308 //
309 // Returns whether the assertion was successful (true) or not (false).
310 func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
311         return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)
312 }
313
314 // NotZerof asserts that i is not the zero value for its type and returns the truth.
315 func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
316         return NotZero(t, i, append([]interface{}{msg}, args...)...)
317 }
318
319 // Panicsf asserts that the code inside the specified PanicTestFunc panics.
320 //
321 //   assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
322 //
323 // Returns whether the assertion was successful (true) or not (false).
324 func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
325         return Panics(t, f, append([]interface{}{msg}, args...)...)
326 }
327
328 // PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
329 // the recovered panic value equals the expected panic value.
330 //
331 //   assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
332 //
333 // Returns whether the assertion was successful (true) or not (false).
334 func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
335         return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)
336 }
337
338 // Regexpf asserts that a specified regexp matches a string.
339 //
340 //  assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
341 //  assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
342 //
343 // Returns whether the assertion was successful (true) or not (false).
344 func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
345         return Regexp(t, rx, str, append([]interface{}{msg}, args...)...)
346 }
347
348 // Subsetf asserts that the specified list(array, slice...) contains all
349 // elements given in the specified subset(array, slice...).
350 //
351 //    assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
352 //
353 // Returns whether the assertion was successful (true) or not (false).
354 func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
355         return Subset(t, list, subset, append([]interface{}{msg}, args...)...)
356 }
357
358 // Truef asserts that the specified value is true.
359 //
360 //    assert.Truef(t, myBool, "error message %s", "formatted")
361 //
362 // Returns whether the assertion was successful (true) or not (false).
363 func Truef(t TestingT, value bool, msg string, args ...interface{}) bool {
364         return True(t, value, append([]interface{}{msg}, args...)...)
365 }
366
367 // WithinDurationf asserts that the two times are within duration delta of each other.
368 //
369 //   assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
370 //
371 // Returns whether the assertion was successful (true) or not (false).
372 func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
373         return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
374 }
375
376 // Zerof asserts that i is the zero value for its type and returns the truth.
377 func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
378         return Zero(t, i, append([]interface{}{msg}, args...)...)
379 }