@@ -7,10 +7,10 @@ import (
7
7
"time"
8
8
)
9
9
10
- type CompareType int
10
+ type compareResult int
11
11
12
12
const (
13
- compareLess CompareType = iota - 1
13
+ compareLess compareResult = iota - 1
14
14
compareEqual
15
15
compareGreater
16
16
)
39
39
bytesType = reflect .TypeOf ([]byte {})
40
40
)
41
41
42
- func compare (obj1 , obj2 interface {}, kind reflect.Kind ) (CompareType , bool ) {
42
+ func compare (obj1 , obj2 interface {}, kind reflect.Kind ) (compareResult , bool ) {
43
43
obj1Value := reflect .ValueOf (obj1 )
44
44
obj2Value := reflect .ValueOf (obj2 )
45
45
@@ -345,7 +345,7 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
345
345
bytesObj2 = obj2Value .Convert (bytesType ).Interface ().([]byte )
346
346
}
347
347
348
- return CompareType (bytes .Compare (bytesObj1 , bytesObj2 )), true
348
+ return compareResult (bytes .Compare (bytesObj1 , bytesObj2 )), true
349
349
}
350
350
case reflect .Uintptr :
351
351
{
@@ -381,7 +381,7 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface
381
381
if h , ok := t .(tHelper ); ok {
382
382
h .Helper ()
383
383
}
384
- return compareTwoValues (t , e1 , e2 , []CompareType {compareGreater }, "\" %v\" is not greater than \" %v\" " , msgAndArgs ... )
384
+ return compareTwoValues (t , e1 , e2 , []compareResult {compareGreater }, "\" %v\" is not greater than \" %v\" " , msgAndArgs ... )
385
385
}
386
386
387
387
// GreaterOrEqual asserts that the first element is greater than or equal to the second
@@ -394,7 +394,7 @@ func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...in
394
394
if h , ok := t .(tHelper ); ok {
395
395
h .Helper ()
396
396
}
397
- return compareTwoValues (t , e1 , e2 , []CompareType {compareGreater , compareEqual }, "\" %v\" is not greater than or equal to \" %v\" " , msgAndArgs ... )
397
+ return compareTwoValues (t , e1 , e2 , []compareResult {compareGreater , compareEqual }, "\" %v\" is not greater than or equal to \" %v\" " , msgAndArgs ... )
398
398
}
399
399
400
400
// Less asserts that the first element is less than the second
@@ -406,7 +406,7 @@ func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{})
406
406
if h , ok := t .(tHelper ); ok {
407
407
h .Helper ()
408
408
}
409
- return compareTwoValues (t , e1 , e2 , []CompareType {compareLess }, "\" %v\" is not less than \" %v\" " , msgAndArgs ... )
409
+ return compareTwoValues (t , e1 , e2 , []compareResult {compareLess }, "\" %v\" is not less than \" %v\" " , msgAndArgs ... )
410
410
}
411
411
412
412
// LessOrEqual asserts that the first element is less than or equal to the second
@@ -419,7 +419,7 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter
419
419
if h , ok := t .(tHelper ); ok {
420
420
h .Helper ()
421
421
}
422
- return compareTwoValues (t , e1 , e2 , []CompareType {compareLess , compareEqual }, "\" %v\" is not less than or equal to \" %v\" " , msgAndArgs ... )
422
+ return compareTwoValues (t , e1 , e2 , []compareResult {compareLess , compareEqual }, "\" %v\" is not less than or equal to \" %v\" " , msgAndArgs ... )
423
423
}
424
424
425
425
// Positive asserts that the specified element is positive
@@ -431,7 +431,7 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
431
431
h .Helper ()
432
432
}
433
433
zero := reflect .Zero (reflect .TypeOf (e ))
434
- return compareTwoValues (t , e , zero .Interface (), []CompareType {compareGreater }, "\" %v\" is not positive" , msgAndArgs ... )
434
+ return compareTwoValues (t , e , zero .Interface (), []compareResult {compareGreater }, "\" %v\" is not positive" , msgAndArgs ... )
435
435
}
436
436
437
437
// Negative asserts that the specified element is negative
@@ -443,10 +443,10 @@ func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
443
443
h .Helper ()
444
444
}
445
445
zero := reflect .Zero (reflect .TypeOf (e ))
446
- return compareTwoValues (t , e , zero .Interface (), []CompareType {compareLess }, "\" %v\" is not negative" , msgAndArgs ... )
446
+ return compareTwoValues (t , e , zero .Interface (), []compareResult {compareLess }, "\" %v\" is not negative" , msgAndArgs ... )
447
447
}
448
448
449
- func compareTwoValues (t TestingT , e1 interface {}, e2 interface {}, allowedComparesResults []CompareType , failMessage string , msgAndArgs ... interface {}) bool {
449
+ func compareTwoValues (t TestingT , e1 interface {}, e2 interface {}, allowedComparesResults []compareResult , failMessage string , msgAndArgs ... interface {}) bool {
450
450
if h , ok := t .(tHelper ); ok {
451
451
h .Helper ()
452
452
}
@@ -469,7 +469,7 @@ func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedCompare
469
469
return true
470
470
}
471
471
472
- func containsValue (values []CompareType , value CompareType ) bool {
472
+ func containsValue (values []compareResult , value compareResult ) bool {
473
473
for _ , v := range values {
474
474
if v == value {
475
475
return true
0 commit comments