github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/pkg/cataloger/erlang/parse_otp_app_test.go (about) 1 package erlang 2 3 import ( 4 "testing" 5 6 "github.com/anchore/syft/syft/artifact" 7 "github.com/anchore/syft/syft/file" 8 "github.com/anchore/syft/syft/pkg" 9 "github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest" 10 ) 11 12 func TestParseOTPApplication(t *testing.T) { 13 tests := []struct { 14 fixture string 15 expected []pkg.Package 16 }{ 17 { 18 fixture: "test-fixtures/rabbitmq.app", 19 expected: []pkg.Package{ 20 { 21 Name: "rabbit", 22 Version: "3.12.10", 23 Language: pkg.Erlang, 24 Type: pkg.ErlangOTPPkg, 25 PURL: "pkg:otp/rabbit@3.12.10", 26 }, 27 }, 28 }, 29 } 30 31 for _, test := range tests { 32 t.Run(test.fixture, func(t *testing.T) { 33 // TODO: relationships are not under test 34 var expectedRelationships []artifact.Relationship 35 36 for idx := range test.expected { 37 test.expected[idx].Locations = file.NewLocationSet(file.NewLocation(test.fixture)) 38 } 39 40 pkgtest.TestFileParser(t, test.fixture, parseOTPApp, test.expected, expectedRelationships) 41 }) 42 } 43 }