mirror of
https://github.com/anchore/syft.git
synced 2026-04-03 21:30:37 +02:00
* Cataloger homebrew (#4) * homebrew cataloger * uptd * fixed test * fixed test * fixed tests * fixed lint * inc schema ver * upt schema * fixed integration test * fixed integration tst * fixed test Signed-off-by: Rez Moss <hi@rezmoss.com> * Update parse_homebrew_test.go Signed-off-by: Rez Moss <hi@rezmoss.com> * Update parse_homebrew_test.go fixed DCO Signed-off-by: Rez Moss <hi@rezmoss.com> Signed-off-by: Rez Moss <hi@rezmoss.com> * Update parse_homebrew_test.go add evd anno to test Signed-off-by: Rez Moss <hi@rezmoss.com> * lint Signed-off-by: Rez Moss <hi@rezmoss.com> * fixed test Signed-off-by: Rez Moss <hi@rezmoss.com> * with PR refactors Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * regenerate json schema Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * fix tests Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * regenerate jsonschema Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * refactor homebrew parser + add tests Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * more resiliant variable extraction Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Rez Moss <hi@rezmoss.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
38 lines
833 B
Go
38 lines
833 B
Go
package homebrew
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_packageURL(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
packageName string
|
|
packageVersion string
|
|
expected string
|
|
}{
|
|
// preemptive based on https://github.com/package-url/purl-spec/pull/281
|
|
{
|
|
name: "standard homebrew package URL",
|
|
packageName: "foo",
|
|
packageVersion: "1.2.3",
|
|
expected: "pkg:brew/foo@1.2.3",
|
|
},
|
|
{
|
|
name: "another example",
|
|
packageName: "bar",
|
|
packageVersion: "9.8.7",
|
|
expected: "pkg:brew/bar@9.8.7",
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
actual := packageURL(test.packageName, test.packageVersion)
|
|
assert.Equal(t, test.expected, actual, "expected package URL to match")
|
|
})
|
|
}
|
|
}
|