-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathutil_test.go
More file actions
22 lines (20 loc) · 877 Bytes
/
util_test.go
File metadata and controls
22 lines (20 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package util
import "testing"
func TestGetImportPathFromRepoURL(t *testing.T) {
tests := map[string]string{
"[email protected]:github/codeql-go.git": "github.com/github/codeql-go",
"[email protected]:github/codeql-go": "github.com/github/codeql-go",
"https://github.com/github/codeql-go.git": "github.com/github/codeql-go",
"https://github.com:12345/github/codeql-go": "github.com/github/codeql-go",
"[email protected]:some/repo": "some.url/some/repo",
"file:///C:/some/path": "",
"https:///no/hostname": "",
"https://hostnameonly": "",
}
for input, expected := range tests {
actual := getImportPathFromRepoURL(input)
if actual != expected {
t.Errorf("Expected getImportPathFromRepoURL(\"%s\") to be \"%s\", but got \"%s\".", input, expected, actual)
}
}
}