mirror of
https://github.com/safedep/vet.git
synced 2025-12-15 21:09:34 -06:00
refactor: Parser target resolver to re-use from lockfile and directory reader feat: Add support for scope based parse target resolution refactor: Dir reader to use config struct test: Fix directory reader tests refactor: Rename parser utils to resolver doc: Add jar scanning example in README.md
31 lines
604 B
Go
31 lines
604 B
Go
package parser
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestListParser(t *testing.T) {
|
|
parsers := List(false)
|
|
assert.Equal(t, 15, len(parsers))
|
|
}
|
|
|
|
func TestInvalidEcosystemMapping(t *testing.T) {
|
|
pw := &parserWrapper{parseAs: "nothing"}
|
|
assert.Empty(t, pw.Ecosystem())
|
|
}
|
|
|
|
func TestEcosystemMapping(t *testing.T) {
|
|
for _, lf := range List(false) {
|
|
t.Run(lf, func(t *testing.T) {
|
|
// For graph parsers, we add a tag to the end of the name
|
|
lf = strings.Split(lf, " ")[0]
|
|
|
|
pw := &parserWrapper{parseAs: lf}
|
|
assert.NotEmpty(t, pw.Ecosystem())
|
|
})
|
|
}
|
|
}
|