mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-04 12:33:04 +00:00
23 lines
492 B
Go
23 lines
492 B
Go
package analyzers
|
|
|
|
import "testing"
|
|
|
|
func TestInferImportName(t *testing.T) {
|
|
tests := []struct {
|
|
path string
|
|
want string
|
|
}{
|
|
{path: "fmt", want: "fmt"},
|
|
{path: "gopkg.in/yaml.v3", want: "yaml"},
|
|
{path: "github.com/gocolly/colly/v2", want: "colly"},
|
|
{path: "golang.org/x/tools/go/packages", want: "packages"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
got := inferImportName(tt.path)
|
|
if got != tt.want {
|
|
t.Fatalf("inferImportName(%q) = %q, want %q", tt.path, got, tt.want)
|
|
}
|
|
}
|
|
}
|