github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/pkg/cataloger/dotnet/cataloger_test.go (about)

     1  package dotnet
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/anchore/syft/syft/pkg/cataloger/generic"
     7  	"github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest"
     8  )
     9  
    10  func TestCataloger_Globs(t *testing.T) {
    11  	tests := []struct {
    12  		name      string
    13  		fixture   string
    14  		cataloger *generic.Cataloger
    15  		expected  []string
    16  	}{
    17  		{
    18  			name:      "obtain deps.json files",
    19  			fixture:   "test-fixtures/glob-paths",
    20  			cataloger: NewDotnetDepsCataloger(),
    21  			expected: []string{
    22  				"src/something.deps.json",
    23  			},
    24  		},
    25  		{
    26  			name:      "obtain portable executable files",
    27  			fixture:   "test-fixtures/glob-paths",
    28  			cataloger: NewDotnetPortableExecutableCataloger(),
    29  			expected: []string{
    30  				"src/something.dll",
    31  				"src/something.exe",
    32  			},
    33  		},
    34  	}
    35  
    36  	for _, test := range tests {
    37  		t.Run(test.name, func(t *testing.T) {
    38  			pkgtest.NewCatalogTester().
    39  				FromDirectory(t, test.fixture).
    40  				ExpectsResolverContentQueries(test.expected).
    41  				TestCataloger(t, test.cataloger)
    42  		})
    43  	}
    44  }