Skip to content

Commit 7bcf74e

Browse files
ikravetsboyan-soubachov
authored andcommitted
fix msgAndArgs forwarding
1 parent c29de71 commit 7bcf74e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

assert/assertion_compare.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface
313313
if h, ok := t.(tHelper); ok {
314314
h.Helper()
315315
}
316-
return compareTwoValues(t, e1, e2, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs)
316+
return compareTwoValues(t, e1, e2, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...)
317317
}
318318

319319
// GreaterOrEqual asserts that the first element is greater than or equal to the second
@@ -326,7 +326,7 @@ func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...in
326326
if h, ok := t.(tHelper); ok {
327327
h.Helper()
328328
}
329-
return compareTwoValues(t, e1, e2, []CompareType{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs)
329+
return compareTwoValues(t, e1, e2, []CompareType{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...)
330330
}
331331

332332
// Less asserts that the first element is less than the second
@@ -338,7 +338,7 @@ func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{})
338338
if h, ok := t.(tHelper); ok {
339339
h.Helper()
340340
}
341-
return compareTwoValues(t, e1, e2, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs)
341+
return compareTwoValues(t, e1, e2, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...)
342342
}
343343

344344
// LessOrEqual asserts that the first element is less than or equal to the second
@@ -351,7 +351,7 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter
351351
if h, ok := t.(tHelper); ok {
352352
h.Helper()
353353
}
354-
return compareTwoValues(t, e1, e2, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs)
354+
return compareTwoValues(t, e1, e2, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...)
355355
}
356356

357357
// Positive asserts that the specified element is positive
@@ -363,7 +363,7 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
363363
h.Helper()
364364
}
365365
zero := reflect.Zero(reflect.TypeOf(e))
366-
return compareTwoValues(t, e, zero.Interface(), []CompareType{compareGreater}, "\"%v\" is not positive", msgAndArgs)
366+
return compareTwoValues(t, e, zero.Interface(), []CompareType{compareGreater}, "\"%v\" is not positive", msgAndArgs...)
367367
}
368368

369369
// Negative asserts that the specified element is negative
@@ -375,7 +375,7 @@ func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
375375
h.Helper()
376376
}
377377
zero := reflect.Zero(reflect.TypeOf(e))
378-
return compareTwoValues(t, e, zero.Interface(), []CompareType{compareLess}, "\"%v\" is not negative", msgAndArgs)
378+
return compareTwoValues(t, e, zero.Interface(), []CompareType{compareLess}, "\"%v\" is not negative", msgAndArgs...)
379379
}
380380

381381
func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool {

assert/assertion_order.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareT
5050
// assert.IsIncreasing(t, []float{1, 2})
5151
// assert.IsIncreasing(t, []string{"a", "b"})
5252
func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
53-
return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs)
53+
return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...)
5454
}
5555

5656
// IsNonIncreasing asserts that the collection is not increasing
@@ -59,7 +59,7 @@ func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) boo
5959
// assert.IsNonIncreasing(t, []float{2, 1})
6060
// assert.IsNonIncreasing(t, []string{"b", "a"})
6161
func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
62-
return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs)
62+
return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...)
6363
}
6464

6565
// IsDecreasing asserts that the collection is decreasing
@@ -68,7 +68,7 @@ func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{})
6868
// assert.IsDecreasing(t, []float{2, 1})
6969
// assert.IsDecreasing(t, []string{"b", "a"})
7070
func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
71-
return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs)
71+
return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...)
7272
}
7373

7474
// IsNonDecreasing asserts that the collection is not decreasing
@@ -77,5 +77,5 @@ func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) boo
7777
// assert.IsNonDecreasing(t, []float{1, 2})
7878
// assert.IsNonDecreasing(t, []string{"a", "b"})
7979
func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
80-
return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs)
80+
return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...)
8181
}

0 commit comments

Comments
 (0)