@@ -77,11 +77,12 @@ type compareTestCase struct {
77
77
}
78
78
79
79
func testCompareValues (t * testing.T , cmp issueComparator , name string , tests []compareTestCase ) {
80
- t .Parallel ()
81
-
82
80
for i , test := range tests { //nolint:gocritic // To ignore rangeValCopy rule
83
81
t .Run (fmt .Sprintf ("%s(%d)" , name , i ), func (t * testing.T ) {
82
+ t .Parallel ()
83
+
84
84
res := cmp (& test .a , & test .b )
85
+
85
86
assert .Equal (t , compToString (test .expected ), compToString (res ))
86
87
})
87
88
}
@@ -197,17 +198,18 @@ func Test_numericCompare(t *testing.T) {
197
198
{2 , 1 , greater },
198
199
}
199
200
200
- t .Parallel ()
201
-
202
201
for i , test := range tests {
203
202
t .Run (fmt .Sprintf ("%s(%d)" , "Numeric Compare" , i ), func (t * testing.T ) {
203
+ t .Parallel ()
204
+
204
205
res := numericCompare (test .a , test .b )
206
+
205
207
assert .Equal (t , compToString (test .expected ), compToString (res ))
206
208
})
207
209
}
208
210
}
209
211
210
- func TestNoSorting (t * testing.T ) {
212
+ func TestSortResults_Process_noSorting (t * testing.T ) {
211
213
tests := make ([]result.Issue , len (issues ))
212
214
copy (tests , issues )
213
215
@@ -218,7 +220,7 @@ func TestNoSorting(t *testing.T) {
218
220
assert .Equal (t , tests , results )
219
221
}
220
222
221
- func TestSorting (t * testing.T ) {
223
+ func TestSortResults_Process_Sorting (t * testing.T ) {
222
224
tests := make ([]result.Issue , len (issues ))
223
225
copy (tests , issues )
224
226
@@ -237,7 +239,9 @@ func compToString(c int) string {
237
239
return "less"
238
240
case greater :
239
241
return "greater"
240
- default :
242
+ case equal :
241
243
return "equal"
244
+ default :
245
+ return "error"
242
246
}
243
247
}
0 commit comments