mirror of
https://github.com/ossf/scorecard.git
synced 2024-09-11 08:55:27 +03:00
parent
0ba864e9c2
commit
d9e35cda2a
@ -27,10 +27,6 @@ import (
|
||||
"github.com/ossf/scorecard/v3/repos"
|
||||
)
|
||||
|
||||
func isLessThanRepoURL(x, y *repos.RepoURI) bool {
|
||||
return x.URL() < y.URL()
|
||||
}
|
||||
|
||||
type fields struct {
|
||||
host string
|
||||
owner string
|
||||
@ -38,6 +34,11 @@ type fields struct {
|
||||
metadata []string
|
||||
}
|
||||
|
||||
//nolint: gocritic
|
||||
func lessThanURI(x, y repos.RepoURI) bool {
|
||||
return fmt.Sprintf("%+v", x) < fmt.Sprintf("%+v", y)
|
||||
}
|
||||
|
||||
func TestGetRepoURLs(t *testing.T) {
|
||||
t.Parallel()
|
||||
testcases := []struct {
|
||||
@ -135,6 +136,7 @@ func TestGetRepoURLs(t *testing.T) {
|
||||
}
|
||||
for _, testcase := range testcases {
|
||||
testcase := testcase
|
||||
|
||||
t.Run(testcase.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
testFile, err := os.OpenFile(testcase.filename, os.O_RDONLY, 0o644)
|
||||
@ -172,8 +174,8 @@ func TestGetRepoURLs(t *testing.T) {
|
||||
return true
|
||||
})
|
||||
|
||||
if !cmp.Equal(rs, repoURLs, exp, cmpopts.EquateEmpty(), cmpopts.SortSlices(isLessThanRepoURL)) {
|
||||
t.Errorf("testcase failed. expected %+v, got %+v", testcase.outcome, repoURLs)
|
||||
if !cmp.Equal(rs, repoURLs, exp, cmpopts.EquateEmpty(), cmpopts.SortSlices(lessThanURI)) {
|
||||
t.Errorf("testcase failed. expected %+v, got %+v", rs, repoURLs)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user