Skip to content

Commit

Permalink
test: sort []cveContent by CVEID (#1674)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaineK00n authored May 10, 2023
1 parent 7475b27 commit ea3d8a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gost/debian_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"reflect"
"testing"

"golang.org/x/exp/slices"

"github.com/future-architect/vuls/models"
gostmodels "github.com/vulsio/gost/models"
)
Expand Down Expand Up @@ -303,7 +305,9 @@ func TestDebian_detect(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := (Debian{}).detect(tt.args.cves, tt.args.srcPkg, tt.args.runningKernel); !reflect.DeepEqual(got, tt.want) {
got := (Debian{}).detect(tt.args.cves, tt.args.srcPkg, tt.args.runningKernel)
slices.SortFunc(got, func(i, j cveContent) bool { return i.cveContent.CveID < j.cveContent.CveID })
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("Debian.detect() = %v, want %v", got, tt.want)
}
})
Expand Down

0 comments on commit ea3d8a6

Please sign in to comment.