(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func 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 | |
| 43 | func TestRunHandoffSubcommandLatestMissing(t *testing.T) { |
| 44 | root := t.TempDir() |
nothing calls this directly
no test coverage detected