@@ -7,10 +7,10 @@ import (
77 "time"
88)
99
10- type CompareType int
10+ type compareResult int
1111
1212const (
13- compareLess CompareType = iota - 1
13+ compareLess compareResult = iota - 1
1414 compareEqual
1515 compareGreater
1616)
3939 bytesType = reflect .TypeOf ([]byte {})
4040)
4141
42- func compare (obj1 , obj2 interface {}, kind reflect.Kind ) (CompareType , bool ) {
42+ func compare (obj1 , obj2 interface {}, kind reflect.Kind ) (compareResult , bool ) {
4343 obj1Value := reflect .ValueOf (obj1 )
4444 obj2Value := reflect .ValueOf (obj2 )
4545
@@ -345,7 +345,7 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
345345 bytesObj2 = obj2Value .Convert (bytesType ).Interface ().([]byte )
346346 }
347347
348- return CompareType (bytes .Compare (bytesObj1 , bytesObj2 )), true
348+ return compareResult (bytes .Compare (bytesObj1 , bytesObj2 )), true
349349 }
350350 case reflect .Uintptr :
351351 {
@@ -381,7 +381,7 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface
381381 if h , ok := t .(tHelper ); ok {
382382 h .Helper ()
383383 }
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 ... )
385385}
386386
387387// 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
394394 if h , ok := t .(tHelper ); ok {
395395 h .Helper ()
396396 }
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 ... )
398398}
399399
400400// 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{})
406406 if h , ok := t .(tHelper ); ok {
407407 h .Helper ()
408408 }
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 ... )
410410}
411411
412412// 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
419419 if h , ok := t .(tHelper ); ok {
420420 h .Helper ()
421421 }
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 ... )
423423}
424424
425425// Positive asserts that the specified element is positive
@@ -431,7 +431,7 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
431431 h .Helper ()
432432 }
433433 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 ... )
435435}
436436
437437// Negative asserts that the specified element is negative
@@ -443,10 +443,10 @@ func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
443443 h .Helper ()
444444 }
445445 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 ... )
447447}
448448
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 {
450450 if h , ok := t .(tHelper ); ok {
451451 h .Helper ()
452452 }
@@ -469,7 +469,7 @@ func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedCompare
469469 return true
470470}
471471
472- func containsValue (values []CompareType , value CompareType ) bool {
472+ func containsValue (values []compareResult , value compareResult ) bool {
473473 for _ , v := range values {
474474 if v == value {
475475 return true
0 commit comments