port ruby cataloger to new generic cataloger pattern (#1322)

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2022-11-04 11:33:55 -04:00
committed by GitHub
parent 3048382bbd
commit 41464bbd7f
8 changed files with 182 additions and 177 deletions
+31
View File
@@ -0,0 +1,31 @@
package ruby
import (
"fmt"
"testing"
"github.com/google/go-cmp/cmp"
)
func Test_packageURL(t *testing.T) {
tests := []struct {
name string
version string
expected string
}{
{
name: "p",
version: "v",
expected: "pkg:gem/p@v",
},
}
for _, test := range tests {
t.Run(fmt.Sprintf("%s@%s", test.name, test.version), func(t *testing.T) {
actual := packageURL(test.name, test.version)
if diff := cmp.Diff(test.expected, actual); diff != "" {
t.Errorf("unexpected packageURL (-want +got):\n%s", diff)
}
})
}
}