From ea3d8a6d0b40df6ccca69a0e0b6d25e87cf971b8 Mon Sep 17 00:00:00 2001 From: MaineK00n Date: Thu, 11 May 2023 00:53:22 +0900 Subject: [PATCH] test: sort []cveContent by CVEID (#1674) --- gost/debian_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gost/debian_test.go b/gost/debian_test.go index 25f0118cd3..f7b4cc788e 100644 --- a/gost/debian_test.go +++ b/gost/debian_test.go @@ -7,6 +7,8 @@ import ( "reflect" "testing" + "golang.org/x/exp/slices" + "github.com/future-architect/vuls/models" gostmodels "github.com/vulsio/gost/models" ) @@ -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) } })