Skip to content

Commit ede25e5

Browse files
committed
tests: improve helper
1 parent 0e7f721 commit ede25e5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pkg/result/processors/sort_results_test.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,14 @@ type compareTestCase struct {
7777
}
7878

7979
func testCompareValues(t *testing.T, cmp issueComparator, name string, tests []compareTestCase) {
80-
t.Parallel()
80+
t.Helper()
8181

8282
for i, test := range tests { //nolint:gocritic // To ignore rangeValCopy rule
8383
t.Run(fmt.Sprintf("%s(%d)", name, i), func(t *testing.T) {
84+
t.Parallel()
85+
8486
res := cmp(&test.a, &test.b)
87+
8588
assert.Equal(t, compToString(test.expected), compToString(res))
8689
})
8790
}
@@ -197,11 +200,12 @@ func Test_numericCompare(t *testing.T) {
197200
{2, 1, greater},
198201
}
199202

200-
t.Parallel()
201-
202203
for i, test := range tests {
203204
t.Run(fmt.Sprintf("%s(%d)", "Numeric Compare", i), func(t *testing.T) {
205+
t.Parallel()
206+
204207
res := numericCompare(test.a, test.b)
208+
205209
assert.Equal(t, compToString(test.expected), compToString(res))
206210
})
207211
}
@@ -237,7 +241,9 @@ func compToString(c int) string {
237241
return "less"
238242
case greater:
239243
return "greater"
240-
default:
244+
case equal:
241245
return "equal"
246+
default:
247+
return "error"
242248
}
243249
}

0 commit comments

Comments
 (0)