MCPcopy Create free account
hub / github.com/mroth/bump / Test_parseGithubRemote

Function Test_parseGithubRemote

git_test.go:5–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func Test_parseGithubRemote(t *testing.T) {
6 tests := []struct {
7 name string
8 remoteURL string
9 wantOwner string
10 wantRepo string
11 wantOk bool
12 }{
13 {
14 name: "GitHub_HTTPS",
15 remoteURL: "https://github.com/mroth/bump.git",
16 wantOwner: "mroth",
17 wantRepo: "bump",
18 wantOk: true,
19 },
20 {
21 name: "GitHub_HTTPS_noExtension",
22 remoteURL: "https://github.com/mroth/bump",
23 wantOwner: "mroth",
24 wantRepo: "bump",
25 wantOk: true,
26 },
27 {
28 name: "GitHub_SSH",
29 remoteURL: "git@github.com:mroth/bump.git",
30 wantOwner: "mroth",
31 wantRepo: "bump",
32 wantOk: true,
33 },
34 }
35 for _, tt := range tests {
36 t.Run(tt.name, func(t *testing.T) {
37 gotOwner, gotRepo, gotOk := parseGithubRemote(tt.remoteURL)
38 if gotOwner != tt.wantOwner {
39 t.Errorf("parseGithubRemote() gotOwner = %v, want %v", gotOwner, tt.wantOwner)
40 }
41 if gotRepo != tt.wantRepo {
42 t.Errorf("parseGithubRemote() gotRepo = %v, want %v", gotRepo, tt.wantRepo)
43 }
44 if gotOk != tt.wantOk {
45 t.Errorf("parseGithubRemote() gotOk = %v, want %v", gotOk, tt.wantOk)
46 }
47 })
48 }
49}
50
51func Test_githubRepoDetect(t *testing.T) {
52 owner, repo, err := githubRepoDetect(".")

Callers

nothing calls this directly

Calls 1

parseGithubRemoteFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…