Files
syft/syft/pkg/apk_metadata_test.go
T
Alex Goodman 8a4886ec0e Add package URL support to the CycloneDX presenter (#164)
* add package URL support to the CycloneDX presenter

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* wrap license tags with licenses

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
2020-08-30 21:40:19 -04:00

34 lines
639 B
Go

package pkg
import (
"github.com/sergi/go-diff/diffmatchpatch"
"testing"
)
func TestApkMetadata_pURL(t *testing.T) {
tests := []struct {
metadata ApkMetadata
expected string
}{
{
metadata: ApkMetadata{
Package: "p",
Version: "v",
Architecture: "a",
},
expected: "pkg:alpine/p@v?arch=a",
},
}
for _, test := range tests {
t.Run(test.expected, func(t *testing.T) {
actual := test.metadata.PackageURL()
if actual != test.expected {
dmp := diffmatchpatch.New()
diffs := dmp.DiffMain(test.expected, actual, true)
t.Errorf("diff: %s", dmp.DiffPrettyText(diffs))
}
})
}
}