@@ -2,6 +2,7 @@ package assert
2
2
3
3
import (
4
4
"bytes"
5
+ "fmt"
5
6
"testing"
6
7
)
7
8
@@ -45,10 +46,13 @@ func TestIsIncreasing(t *testing.T) {
45
46
{collection : []uint64 {2 , 1 }, msg : `"2" is not less than "1"` },
46
47
{collection : []float32 {2.34 , 1.23 }, msg : `"2.34" is not less than "1.23"` },
47
48
{collection : []float64 {2.34 , 1.23 }, msg : `"2.34" is not less than "1.23"` },
49
+ {collection : struct {}{}, msg : `object struct {} is not an ordered collection` },
48
50
} {
49
- out := & outputT {buf : bytes .NewBuffer (nil )}
50
- False (t , IsIncreasing (out , currCase .collection ))
51
- Contains (t , out .buf .String (), currCase .msg )
51
+ t .Run (fmt .Sprintf ("%#v" , currCase .collection ), func (t * testing.T ) {
52
+ out := & outputT {buf : bytes .NewBuffer (nil )}
53
+ False (t , IsIncreasing (out , currCase .collection ))
54
+ Contains (t , out .buf .String (), currCase .msg )
55
+ })
52
56
}
53
57
}
54
58
@@ -92,10 +96,13 @@ func TestIsNonIncreasing(t *testing.T) {
92
96
{collection : []uint64 {1 , 2 }, msg : `"1" is not greater than or equal to "2"` },
93
97
{collection : []float32 {1.23 , 2.34 }, msg : `"1.23" is not greater than or equal to "2.34"` },
94
98
{collection : []float64 {1.23 , 2.34 }, msg : `"1.23" is not greater than or equal to "2.34"` },
99
+ {collection : struct {}{}, msg : `object struct {} is not an ordered collection` },
95
100
} {
96
- out := & outputT {buf : bytes .NewBuffer (nil )}
97
- False (t , IsNonIncreasing (out , currCase .collection ))
98
- Contains (t , out .buf .String (), currCase .msg )
101
+ t .Run (fmt .Sprintf ("%#v" , currCase .collection ), func (t * testing.T ) {
102
+ out := & outputT {buf : bytes .NewBuffer (nil )}
103
+ False (t , IsNonIncreasing (out , currCase .collection ))
104
+ Contains (t , out .buf .String (), currCase .msg )
105
+ })
99
106
}
100
107
}
101
108
@@ -139,10 +146,13 @@ func TestIsDecreasing(t *testing.T) {
139
146
{collection : []uint64 {1 , 2 }, msg : `"1" is not greater than "2"` },
140
147
{collection : []float32 {1.23 , 2.34 }, msg : `"1.23" is not greater than "2.34"` },
141
148
{collection : []float64 {1.23 , 2.34 }, msg : `"1.23" is not greater than "2.34"` },
149
+ {collection : struct {}{}, msg : `object struct {} is not an ordered collection` },
142
150
} {
143
- out := & outputT {buf : bytes .NewBuffer (nil )}
144
- False (t , IsDecreasing (out , currCase .collection ))
145
- Contains (t , out .buf .String (), currCase .msg )
151
+ t .Run (fmt .Sprintf ("%#v" , currCase .collection ), func (t * testing.T ) {
152
+ out := & outputT {buf : bytes .NewBuffer (nil )}
153
+ False (t , IsDecreasing (out , currCase .collection ))
154
+ Contains (t , out .buf .String (), currCase .msg )
155
+ })
146
156
}
147
157
}
148
158
@@ -186,10 +196,13 @@ func TestIsNonDecreasing(t *testing.T) {
186
196
{collection : []uint64 {2 , 1 }, msg : `"2" is not less than or equal to "1"` },
187
197
{collection : []float32 {2.34 , 1.23 }, msg : `"2.34" is not less than or equal to "1.23"` },
188
198
{collection : []float64 {2.34 , 1.23 }, msg : `"2.34" is not less than or equal to "1.23"` },
199
+ {collection : struct {}{}, msg : `object struct {} is not an ordered collection` },
189
200
} {
190
- out := & outputT {buf : bytes .NewBuffer (nil )}
191
- False (t , IsNonDecreasing (out , currCase .collection ))
192
- Contains (t , out .buf .String (), currCase .msg )
201
+ t .Run (fmt .Sprintf ("%#v" , currCase .collection ), func (t * testing.T ) {
202
+ out := & outputT {buf : bytes .NewBuffer (nil )}
203
+ False (t , IsNonDecreasing (out , currCase .collection ))
204
+ Contains (t , out .buf .String (), currCase .msg )
205
+ })
193
206
}
194
207
}
195
208
0 commit comments