github.com/lineaje-labs/syft@v0.98.1-0.20231227153149-9e393f60ff1b/syft/pkg/cataloger/cpp/cataloger_test.go (about) 1 package cpp 2 3 import ( 4 "testing" 5 6 "github.com/lineaje-labs/syft/syft/pkg/cataloger/internal/pkgtest" 7 ) 8 9 func TestCataloger_Globs(t *testing.T) { 10 tests := []struct { 11 name string 12 fixture string 13 expected []string 14 }{ 15 { 16 name: "obtain conan files", 17 fixture: "test-fixtures/glob-paths", 18 expected: []string{ 19 "somewhere/src/conanfile.txt", 20 "somewhere/src/conan.lock", 21 }, 22 }, 23 } 24 25 for _, test := range tests { 26 t.Run(test.name, func(t *testing.T) { 27 pkgtest.NewCatalogTester(). 28 FromDirectory(t, test.fixture). 29 ExpectsResolverContentQueries(test.expected). 30 TestCataloger(t, NewConanCataloger()) 31 }) 32 } 33 } 34 35 func TestCatalogerInfo_Globs(t *testing.T) { 36 tests := []struct { 37 name string 38 fixture string 39 expected []string 40 }{ 41 { 42 name: "obtain conan files", 43 fixture: "test-fixtures/glob-paths", 44 expected: []string{ 45 "somewhere/src/conaninfo.txt", 46 }, 47 }, 48 } 49 50 for _, test := range tests { 51 t.Run(test.name, func(t *testing.T) { 52 pkgtest.NewCatalogTester(). 53 FromDirectory(t, test.fixture). 54 ExpectsResolverContentQueries(test.expected). 55 TestCataloger(t, NewConanInfoCataloger()) 56 }) 57 } 58 }