github.com/anchore/syft@v1.38.2/syft/pkg/cataloger/ocaml/package_test.go (about)

     1  package ocaml
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func Test_packageURL(t *testing.T) {
    10  
    11  	type args struct {
    12  		name    string
    13  		version string
    14  	}
    15  	tests := []struct {
    16  		name string
    17  		args args
    18  		want string
    19  	}{
    20  		{
    21  			name: "go case",
    22  			args: args{
    23  				name:    "ocaml-base-compiler",
    24  				version: "5.2.0",
    25  			},
    26  			want: "pkg:opam/ocaml-base-compiler@5.2.0",
    27  		},
    28  	}
    29  	for _, tt := range tests {
    30  		t.Run(tt.name, func(t *testing.T) {
    31  			assert.Equal(t, tt.want, opamPackageURL(tt.args.name, tt.args.version))
    32  		})
    33  	}
    34  }