mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 06:26:30 +01:00
* 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>
34 lines
639 B
Go
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))
|
|
}
|
|
})
|
|
}
|
|
}
|