(t *testing.T)
| 3 | import "testing" |
| 4 | |
| 5 | func 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 | |
| 51 | func Test_githubRepoDetect(t *testing.T) { |
| 52 | owner, repo, err := githubRepoDetect(".") |
nothing calls this directly
no test coverage detected
searching dependent graphs…