-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support installing mods from Gitlab repositories (#622)
* Support installing mods from Gitlab repositories. Closes #619 * v1.6.7 * fix: report configuration file loading failure as warning to avoid shutting down FDW (#609) * update changelog --------- Co-authored-by: Patrick Decat <pdecat@gmail.com>
- Loading branch information
Showing
5 changed files
with
90 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package modinstaller | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestTransformToGitURL(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
input string | ||
urlMode GitUrlMode | ||
expected string | ||
}{ | ||
// GitHub - SSH mode | ||
{"GitHub SSH - Basic", "github.com/user/repo", GitUrlModeSSH, "git@github.com:user/repo.git"}, | ||
{"GitHub SSH - With Git Prefix", "git@github.com/user/repo", GitUrlModeSSH, "git@github.com:user/repo.git"}, | ||
{"GitHub SSH - With .git", "github.com/user/repo.git", GitUrlModeSSH, "git@github.com:user/repo.git"}, | ||
|
||
// GitHub - HTTPS mode | ||
{"GitHub HTTPS - Basic", "github.com/user/repo", GitUrlModeHTTPS, "https://github.com/user/repo"}, | ||
{"GitHub HTTPS - Already HTTPS", "https://github.com/user/repo", GitUrlModeHTTPS, "https://github.com/user/repo"}, | ||
|
||
// GitLab - SSH mode | ||
{"GitLab SSH - Basic", "gitlab.com/user/repo", GitUrlModeSSH, "git@gitlab.com:user/repo.git"}, | ||
{"GitLab SSH - With Git Prefix", "git@gitlab.com/user/repo", GitUrlModeSSH, "git@gitlab.com:user/repo.git"}, | ||
{"GitLab SSH - With .git", "gitlab.com/user/repo.git", GitUrlModeSSH, "git@gitlab.com:user/repo.git"}, | ||
|
||
// GitLab - HTTPS mode | ||
{"GitLab HTTPS - Basic", "gitlab.com/user/repo", GitUrlModeHTTPS, "https://gitlab.com/user/repo"}, | ||
{"GitLab HTTPS - Already HTTPS", "https://gitlab.com/user/repo", GitUrlModeHTTPS, "https://gitlab.com/user/repo"}, | ||
{"GitLab HTTPS - with domain name", "example.gitlab.com/user/repo", GitUrlModeHTTPS, "https://example.gitlab.com/user/repo"}, | ||
|
||
// Edge cases | ||
{"Unsupported Host", "other-host.com/user/repo", GitUrlModeSSH, "other-host.com/user/repo"}, | ||
{"Invalid Input - Empty", "", GitUrlModeSSH, ""}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got := transformToGitURL(tt.input, tt.urlMode) | ||
if got != tt.expected { | ||
t.Errorf("transformToGitURL(%q, %q) = %q; want %q", tt.input, tt.urlMode, got, tt.expected) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters