Skip to content

Commit 18da1e1

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

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pkg/result/processors/sort_results_test.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,12 @@ type compareTestCase struct {
7777
}
7878

7979
func testCompareValues(t *testing.T, cmp issueComparator, name string, tests []compareTestCase) {
80-
t.Parallel()
81-
8280
for i, test := range tests { //nolint:gocritic // To ignore rangeValCopy rule
8381
t.Run(fmt.Sprintf("%s(%d)", name, i), func(t *testing.T) {
82+
t.Parallel()
83+
8484
res := cmp(&test.a, &test.b)
85+
8586
assert.Equal(t, compToString(test.expected), compToString(res))
8687
})
8788
}
@@ -197,11 +198,12 @@ func Test_numericCompare(t *testing.T) {
197198
{2, 1, greater},
198199
}
199200

200-
t.Parallel()
201-
202201
for i, test := range tests {
203202
t.Run(fmt.Sprintf("%s(%d)", "Numeric Compare", i), func(t *testing.T) {
203+
t.Parallel()
204+
204205
res := numericCompare(test.a, test.b)
206+
205207
assert.Equal(t, compToString(test.expected), compToString(res))
206208
})
207209
}
@@ -237,7 +239,9 @@ func compToString(c int) string {
237239
return "less"
238240
case greater:
239241
return "greater"
240-
default:
242+
case equal:
241243
return "equal"
244+
default:
245+
return "error"
242246
}
243247
}

0 commit comments

Comments
 (0)