-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpagesearch_test.go
47 lines (38 loc) · 899 Bytes
/
pagesearch_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package modcheck_test
import (
"testing"
"github.com/euanwm/modcheck"
)
func Test_FindGitHub(t *testing.T) {
t.Parallel()
expected := "github.com/go-gorm/mysql"
actual := modcheck.FindGitHub("gorm.io/driver/mysql")
if expected != actual {
t.Errorf("expected %v, got %v", expected, actual)
}
}
func Test_FindGitHubMultiple(t *testing.T) {
t.Parallel()
links := []string{
"golang.org/x/crypto",
"gorm.io/driver/mysql",
"gorm.io/driver/postgres",
"gorm.io/driver/sqlite",
"gorm.io/driver/sqlserver",
"gorm.io/gorm",
}
expected := []string{
"",
"github.com/go-gorm/mysql",
"github.com/go-gorm/postgres",
"github.com/go-gorm/sqlite",
"github.com/go-gorm/sqlserver",
"github.com/go-gorm/gorm",
}
for i, link := range links {
actual := modcheck.FindGitHub(link)
if expected[i] != actual {
t.Errorf("expected %v, got %v", expected[i], actual)
}
}
}