remove variadic functionality from intRef() test helper

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman 2021-06-02 17:13:31 -04:00
parent 2f81a2548c
commit afbd8f8ea0
No known key found for this signature in database
GPG Key ID: 5CB45AE22BAB7EA7
3 changed files with 12 additions and 21 deletions

View File

@ -91,7 +91,7 @@ func TestPackageURL(t *testing.T) {
Metadata: pkg.RpmdbMetadata{
Name: "name",
Version: "0.1.0",
Epoch: intRef(),
Epoch: nil,
Arch: "amd64",
Release: "3",
},
@ -131,9 +131,6 @@ func TestPackageURL(t *testing.T) {
}
}
func intRef(i ...int) *int {
if len(i) == 0 {
return nil
}
return &i[0]
func intRef(i int) *int {
return &i
}

View File

@ -72,7 +72,7 @@ func TestParseRpmDB(t *testing.T) {
MetadataType: pkg.RpmdbMetadataType,
Metadata: pkg.RpmdbMetadata{
Name: "dive",
Epoch: intRef(),
Epoch: nil,
Arch: "x86_64",
Release: "1",
Version: "0.9.2",
@ -99,7 +99,7 @@ func TestParseRpmDB(t *testing.T) {
MetadataType: pkg.RpmdbMetadataType,
Metadata: pkg.RpmdbMetadata{
Name: "dive",
Epoch: intRef(),
Epoch: nil,
Arch: "x86_64",
Release: "1",
Version: "0.9.2",
@ -204,9 +204,6 @@ func TestToElVersion(t *testing.T) {
}
}
func intRef(i ...int) *int {
if len(i) == 0 {
return nil
}
return &i[0]
func intRef(i int) *int {
return &i
}

View File

@ -10,13 +10,6 @@ import (
"github.com/sergi/go-diff/diffmatchpatch"
)
func intRef(i ...int) *int {
if len(i) == 0 {
return nil
}
return &i[0]
}
func TestRpmMetadata_pURL(t *testing.T) {
tests := []struct {
distro distro.Distro
@ -45,7 +38,7 @@ func TestRpmMetadata_pURL(t *testing.T) {
Version: "v",
Arch: "a",
Release: "r",
Epoch: intRef(),
Epoch: nil,
},
expected: "pkg:rpm/redhat/p@v-r?arch=a",
},
@ -104,3 +97,7 @@ func TestRpmMetadata_fileOwner(t *testing.T) {
})
}
}
func intRef(i int) *int {
return &i
}