From 685783ac521cadb231e49f8f94950f8f99ae515a Mon Sep 17 00:00:00 2001
From: Bracken <abdawson@gmail.com>
Date: Tue, 8 Aug 2023 13:13:19 +0100
Subject: [PATCH] Clarify error message for incorrect use of IsIncreasing et al
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Because maps are collections but not ordered.

Co-authored-by: Olivier Mengué <dolmen@cpan.org>
---
 assert/assertion_order.go      | 2 +-
 assert/assertion_order_test.go | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/assert/assertion_order.go b/assert/assertion_order.go
index 46f3cb4..b286e2d 100644
--- a/assert/assertion_order.go
+++ b/assert/assertion_order.go
@@ -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)
diff --git a/assert/assertion_order_test.go b/assert/assertion_order_test.go
index e4f0e92..97dd77f 100644
--- a/assert/assertion_order_test.go
+++ b/assert/assertion_order_test.go
@@ -44,7 +44,7 @@ func TestIsIncreasing(t *testing.T) {
 		{collection: []uint64{2, 1}, msg: `"2" is not less than "1"`},
 		{collection: []float32{2.34, 1.23}, msg: `"2.34" is not less than "1.23"`},
 		{collection: []float64{2.34, 1.23}, msg: `"2.34" is not less than "1.23"`},
-		{collection: struct{}{}, msg: `object struct {} is not a collection`},
+		{collection: struct{}{}, msg: `object struct {} is not an ordered collection`},
 	} {
 		t.Run(fmt.Sprintf("%#v", currCase.collection), func(t *testing.T) {
 			out := &outputT{buf: bytes.NewBuffer(nil)}
@@ -92,7 +92,7 @@ func TestIsNonIncreasing(t *testing.T) {
 		{collection: []uint64{1, 2}, msg: `"1" is not greater than or equal to "2"`},
 		{collection: []float32{1.23, 2.34}, msg: `"1.23" is not greater than or equal to "2.34"`},
 		{collection: []float64{1.23, 2.34}, msg: `"1.23" is not greater than or equal to "2.34"`},
-		{collection: struct{}{}, msg: `object struct {} is not a collection`},
+		{collection: struct{}{}, msg: `object struct {} is not an ordered collection`},
 	} {
 		t.Run(fmt.Sprintf("%#v", currCase.collection), func(t *testing.T) {
 			out := &outputT{buf: bytes.NewBuffer(nil)}
@@ -140,7 +140,7 @@ func TestIsDecreasing(t *testing.T) {
 		{collection: []uint64{1, 2}, msg: `"1" is not greater than "2"`},
 		{collection: []float32{1.23, 2.34}, msg: `"1.23" is not greater than "2.34"`},
 		{collection: []float64{1.23, 2.34}, msg: `"1.23" is not greater than "2.34"`},
-		{collection: struct{}{}, msg: `object struct {} is not a collection`},
+		{collection: struct{}{}, msg: `object struct {} is not an ordered collection`},
 	} {
 		t.Run(fmt.Sprintf("%#v", currCase.collection), func(t *testing.T) {
 			out := &outputT{buf: bytes.NewBuffer(nil)}
@@ -188,7 +188,7 @@ func TestIsNonDecreasing(t *testing.T) {
 		{collection: []uint64{2, 1}, msg: `"2" is not less than or equal to "1"`},
 		{collection: []float32{2.34, 1.23}, msg: `"2.34" is not less than or equal to "1.23"`},
 		{collection: []float64{2.34, 1.23}, msg: `"2.34" is not less than or equal to "1.23"`},
-		{collection: struct{}{}, msg: `object struct {} is not a collection`},
+		{collection: struct{}{}, msg: `object struct {} is not an ordered collection`},
 	} {
 		t.Run(fmt.Sprintf("%#v", currCase.collection), func(t *testing.T) {
 			out := &outputT{buf: bytes.NewBuffer(nil)}