Skip to content

Commit

Permalink
Clarify error message for incorrect use of IsIncreasing et al
Browse files Browse the repository at this point in the history
Because maps are collections but not ordered.

Co-authored-by: Olivier Mengué <[email protected]>
  • Loading branch information
brackendawson and dolmen authored Aug 8, 2023
1 parent 3860ffc commit c30fce7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion assert/assertion_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool {
objKind := reflect.TypeOf(object).Kind()
if objKind != reflect.Slice && objKind != reflect.Array {
return Fail(t, fmt.Sprintf("object %T is not a collection", object), msgAndArgs...)
return Fail(t, fmt.Sprintf("object %T is not an ordered collection", object), msgAndArgs...)
}

objValue := reflect.ValueOf(object)
Expand Down

0 comments on commit c30fce7

Please sign in to comment.