MCPcopy Create free account
hub / github.com/JordanCoin/codemap / TestIsGitHubURLAndExtractRepoName

Function TestIsGitHubURLAndExtractRepoName

main_helpers_test.go:18–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func TestIsGitHubURLAndExtractRepoName(t *testing.T) {
19 cases := []struct {
20 url string
21 isRepo bool
22 repo string
23 }{
24 {url: "github.com/acme/codemap", isRepo: true, repo: "acme/codemap"},
25 {url: "https://github.com/acme/codemap.git", isRepo: true, repo: "acme/codemap"},
26 {url: "http://github.com/acme/codemap/", isRepo: true, repo: "acme/codemap"},
27 {url: "gitlab.com/acme/codemap", isRepo: true, repo: "acme/codemap"},
28 {url: "example.com/acme/codemap", isRepo: false, repo: "example.com/acme/codemap"},
29 }
30
31 for _, tc := range cases {
32 t.Run(tc.url, func(t *testing.T) {
33 if got := isGitHubURL(tc.url); got != tc.isRepo {
34 t.Fatalf("isGitHubURL(%q) = %v, want %v", tc.url, got, tc.isRepo)
35 }
36 if got := extractRepoName(tc.url); got != tc.repo {
37 t.Fatalf("extractRepoName(%q) = %q, want %q", tc.url, got, tc.repo)
38 }
39 })
40 }
41}
42
43func TestRunHandoffSubcommandLatestMissing(t *testing.T) {
44 root := t.TempDir()

Callers

nothing calls this directly

Calls 2

isGitHubURLFunction · 0.85
extractRepoNameFunction · 0.85

Tested by

no test coverage detected